From c2e7737463236238998b96db633f25ee9c4462da Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 18 Oct 2021 16:46:42 +1300 Subject: [PATCH] Fix test to use postProcess flow --- tests/phpunit/CRM/Contribute/BAO/ContributionTest.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php index 6b0c5bbc10..744f552a78 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php @@ -1198,7 +1198,7 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2"; /** * Function to create contribution with tax. */ - public function createContributionWithTax($params = [], $isCompleted = TRUE) { + public function createContributionWithTax($params = [], $isCompleted = TRUE): array { if (!isset($params['total_amount'])) { $params['total_amount'] = 100; } @@ -1206,15 +1206,16 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2"; $this->enableTaxAndInvoicing(); $financialType = $this->createFinancialType(); $financialAccount = $this->addTaxAccountToFinancialType($financialType['id']); - $form = new CRM_Contribute_Form_Contribution(); - - $form->testSubmit([ + /* @var CRM_Contribute_Form_Contribution $form */ + $form = $this->getFormObject('CRM_Contribute_Form_Contribution', [ 'total_amount' => $params['total_amount'], 'financial_type_id' => $financialType['id'], 'contact_id' => $contactId, 'contribution_status_id' => $isCompleted ? 1 : 2, 'price_set_id' => 0, - ], CRM_Core_Action::ADD); + ]); + $form->buildForm(); + $form->postProcess(); $contribution = $this->callAPISuccessGetSingle('Contribution', [ 'contact_id' => $contactId, -- 2.25.1