Merge pull request #23077 from eileenmcnaughton/js_cancel
[civicrm-core.git] / tests / phpunit / CRM / Financial / Page / AjaxBatchSummaryTest.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 * Test for CRM_Financial_Page_Ajax class.
14 * @group headless
15 */
16 class CRM_Financial_Page_AjaxBatchSummaryTest extends CiviUnitTestCase {
17
18 /**
19 * Test the makeBatchSummary function.
20 *
21 * We want to ensure changing the method of obtaining status and payment_instrument
22 * does not cause any regression.
23 *
24 * @throws \API_Exception
25 * @throws \CRM_Core_Exception
26 */
27 public function testMakeBatchSummary(): void {
28 $batch = $this->callAPISuccess('Batch', 'create', ['title' => 'test', 'status_id' => 'Open', 'payment_instrument_id' => 'Cash']);
29
30 $makeBatchSummary = CRM_Financial_Page_AJAX::makeBatchSummary($batch['id']);
31
32 $this->assertEquals('Open', $makeBatchSummary['status']);
33 $this->assertEquals('Cash', $makeBatchSummary['payment_instrument']);
34 }
35
36 }