From 53a51611b9ec9875769750749482272aef67379d Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 27 Sep 2021 10:20:25 +1300 Subject: [PATCH] Test cleanup -convert to use postProcess --- .../CRM/Financial/BAO/FinancialItemTest.php | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php b/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php index 71b88d4cc5..e4c8cbaefb 100644 --- a/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php +++ b/tests/phpunit/CRM/Financial/BAO/FinancialItemTest.php @@ -30,10 +30,6 @@ class CRM_Financial_BAO_FinancialItemTest extends CiviUnitTestCase { /** * Clean up after each test. - * - * @throws \API_Exception - * @throws \CRM_Core_Exception - * @throws \CiviCRM_API3_Exception */ public function tearDown(): void { $this->quickCleanUpFinancialEntities(); @@ -43,7 +39,6 @@ class CRM_Financial_BAO_FinancialItemTest extends CiviUnitTestCase { /** * Check method add() * - * @throws \CRM_Core_Exception * @throws \CiviCRM_API3_Exception */ public function testAdd(): void { @@ -86,7 +81,6 @@ class CRM_Financial_BAO_FinancialItemTest extends CiviUnitTestCase { * Check method retrieve() * * @throws \CiviCRM_API3_Exception - * @throws \CRM_Core_Exception */ public function testRetrieve(): void { $price = 100.00; @@ -125,9 +119,8 @@ class CRM_Financial_BAO_FinancialItemTest extends CiviUnitTestCase { /** * Check method create() * - * @throws \CRM_Core_Exception - * @throws \CiviCRM_API3_Exception * @throws \API_Exception + * @throws \CiviCRM_API3_Exception */ public function testCreate(): void { $contactID = $this->individualCreate(); @@ -219,9 +212,6 @@ class CRM_Financial_BAO_FinancialItemTest extends CiviUnitTestCase { /** * Check method getPreviousFinancialItem(). - * - * @throws \CRM_Core_Exception - * @throws \CiviCRM_API3_Exception */ public function testGetPreviousFinancialItem(): void { $contactId = $this->individualCreate(); @@ -262,8 +252,8 @@ class CRM_Financial_BAO_FinancialItemTest extends CiviUnitTestCase { * punctuation used to refer to thousands. * * @throws \CRM_Core_Exception - * @throws \CiviCRM_API3_Exception * @throws \Civi\Payment\Exception\PaymentProcessorException + * * @dataProvider getThousandSeparators */ public function testGetPreviousFinancialItemHavingTax(string $thousandSeparator): void { @@ -271,14 +261,14 @@ class CRM_Financial_BAO_FinancialItemTest extends CiviUnitTestCase { $contactId = $this->individualCreate(); $this->enableTaxAndInvoicing(); $this->addTaxAccountToFinancialType(1); - $form = new CRM_Contribute_Form_Contribution(); - $form->testSubmit([ + $form = $this->getFormObject('CRM_Contribute_Form_Contribution', [ 'total_amount' => 100, 'financial_type_id' => 1, 'contact_id' => $contactId, 'contribution_status_id' => 1, 'price_set_id' => 0, - ], CRM_Core_Action::ADD); + ]); + $form->postProcess(); $contribution = $this->callAPISuccessGetSingle('Contribution', [ 'contact_id' => $contactId, -- 2.25.1