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

RecurForms test fixes #22784

Merged
merged 1 commit into from
Feb 17, 2022
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
19 changes: 13 additions & 6 deletions tests/phpunit/CRM/Contribute/Form/RecurForms.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
*/
class CRM_Contribute_Form_RecurForms extends CiviUnitTestCase {

/**
* @var int
*/
protected $paymentProcessorId;

/**
* Get contact id.
*
Expand All @@ -31,17 +36,18 @@ public function getContactID(): int {
*/
public function addContribution(): void {
$this->paymentProcessorId = $this->processorCreate();
$this->callAPISuccess('Order', 'create', [
$order = $this->callAPISuccess('Order', 'create', [
'contact_id' => $this->getContactID(),
'contribution_recur_id' => $this->getContributionRecurID(),
'financial_type_id' => 'Donation',
'total_amount' => 10,
'contribution_page_id' => $this->getContributionPageID(),
'api.Payment.create' => [
'total_amount' => 10,
'payment_processor_id' => $this->paymentProcessorId,
'is_send_contribution_notification' => FALSE,
],
]);
$this->callAPISuccess('Payment', 'create', [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't have to be separated. I just find it a bit easier to debug this way.

'contribution_id' => $order['id'],
'total_amount' => 10,
'payment_processor_id' => $this->paymentProcessorId,
'is_send_contribution_notification' => FALSE,
]);
}

Expand All @@ -58,6 +64,7 @@ public function getContributionRecurID(): int {
'installments' => 12,
'frequency_interval' => 1,
'frequency_unit' => 'month',
'payment_processor_id' => $this->paymentProcessorId,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the important change

])['id'];
}
return $this->ids['ContributionRecur'][0];
Expand Down