Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test to use full form flow #29903

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions tests/phpunit/CRM/Contribute/Form/ContributionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -622,12 +622,9 @@ public function testEmailReceiptOnPayLater(bool $isTaxed): void {
$params['price_' . $priceFieldID] = [$id => 1];
}
}
$form = $this->getContributionForm($params);
$mailUtil = new CiviMailUtils($this, TRUE);
$form->_priceSet = current(CRM_Price_BAO_PriceSet::getSetDetail($priceSetID));
$form->postProcess();
$this->submitContributionForm($params);
if ($isTaxed) {
$mailUtil->checkMailLog([
$this->assertMailSentContainingString(
'Dear Anthony,

===========================================================
Expand All @@ -648,10 +645,10 @@ public function testEmailReceiptOnPayLater(bool $isTaxed): void {
Total Amount : $110.00
Contribution Date: ' . date('m/d/Y') . '
Receipt Date: ' . date('m/d/Y'),
]);
);
}
else {
$mailUtil->checkMailLog([
$this->assertMailSentContainingString(
'Dear Anthony,

===========================================================
Expand All @@ -669,8 +666,9 @@ public function testEmailReceiptOnPayLater(bool $isTaxed): void {
Total Amount : $100.00
Contribution Date: ' . date('m/d/Y') . '
Receipt Date: ' . date('m/d/Y'),
],
['Amount before Tax', 'Tax Amount']);
);
$this->assertMailSentNotContainingString('Amount before Tax');
$this->assertMailSentNotContainingString('Tax Amount');
}
}

Expand Down Expand Up @@ -2108,6 +2106,7 @@ public function testContributionFormRuleDuplicateTrxn(): void {
protected function getContributionForm(array $formValues): CRM_Contribute_Form_Contribution {
/** @var CRM_Contribute_Form_Contribution $form */
$form = $this->getFormObject('CRM_Contribute_Form_Contribution', $formValues);
$form->preProcess();
$form->buildForm();
return $form;
}
Expand Down