Skip to content

Commit

Permalink
add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
demeritcowboy committed Jun 13, 2022
1 parent 4f8b435 commit d1df690
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/phpunit/CRM/Contribute/Form/UpdateSubscriptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,23 @@ public function getExpectedMailStrings(): array {
];
}

/**
* Test the Additional Details pane loads for recurring contributions.
*/
public function testAdditionalDetails() {
$this->addContribution();
$templateContribution = CRM_Contribute_BAO_ContributionRecur::getTemplateContribution($this->getContributionRecurID());
print_r($templateContribution);
$_GET['q'] = $_REQUEST['q'] = 'civicrm/contact/view/contribution';
$_GET['snippet'] = $_REQUEST['snippet'] = 4;
$_GET['id'] = $_REQUEST['id'] = $templateContribution['id'];
$_GET['formType'] = $_REQUEST['formType'] = 'AdditionalDetail';
$form = $this->getFormObject('CRM_Contribute_Form_Contribution', []);
$form->buildForm();
unset($_GET['q'], $_REQUEST['q']);
unset($_GET['snippet'], $_REQUEST['snippet']);
unset($_GET['id'], $_REQUEST['id']);
unset($_GET['formType'], $_REQUEST['formType']);
}

}
8 changes: 8 additions & 0 deletions tests/phpunit/CRMTraits/Contribute/RecurFormsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ public function addContribution(): void {
'payment_processor_id' => $this->paymentProcessorId,
'is_send_contribution_notification' => FALSE,
]);
$this->callAPISuccess('Contribution', 'create', [
'contact_id' => $this->getContactID(),
'contribution_recur_id' => $this->getContributionRecurID(),
'financial_type_id' => 'Donation',
'total_amount' => 10,
'contribution_page_id' => $this->getContributionPageID(),
'contribution_status_id' => 'Template',
]);
}

/**
Expand Down

0 comments on commit d1df690

Please sign in to comment.