Skip to content

Commit

Permalink
Merge pull request #21849 from eileenmcnaughton/testy
Browse files Browse the repository at this point in the history
Fix test to use postProcess flow
  • Loading branch information
seamuslee001 authored Oct 18, 2021
2 parents 4189204 + c2e7737 commit 8c54895
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/phpunit/CRM/Contribute/BAO/ContributionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1198,23 +1198,24 @@ public function testProportionallyAssignedForPIChange() {
/**
* 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;
}
$contactId = $this->individualCreate();
$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,
Expand Down

0 comments on commit 8c54895

Please sign in to comment.