Skip to content

Commit

Permalink
unit test for 17455
Browse files Browse the repository at this point in the history
  • Loading branch information
Jitendra Purohit authored and mattwire committed Jul 19, 2020
1 parent 3387b5c commit 2e18711
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/phpunit/CRM/Contribute/BAO/ContributionRecurTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ public function testGetTemplateContributionNewTemplate() {
'contribution_recur_id' => $contributionRecur['id'],
'total_amount' => '3.00',
'financial_type_id' => 1,
'source' => 'Template Contribution',
'payment_instrument_id' => 1,
'currency' => 'USD',
'contact_id' => $this->individualCreate(),
Expand All @@ -237,6 +238,7 @@ public function testGetTemplateContributionNewTemplate() {
'contribution_recur_id' => $contributionRecur['id'],
'total_amount' => '3.00',
'financial_type_id' => 1,
'source' => 'Non-template Contribution',
'payment_instrument_id' => 1,
'currency' => 'USD',
'contact_id' => $this->individualCreate(),
Expand All @@ -246,6 +248,12 @@ public function testGetTemplateContributionNewTemplate() {
$fetchedTemplate = CRM_Contribute_BAO_ContributionRecur::getTemplateContribution($contributionRecur['id']);
// Fetched template should be the is_template, not the latest contrib
$this->assertEquals($fetchedTemplate['id'], $templateContrib['id']);

$repeatContribution = $this->callAPISuccess('Contribution', 'repeattransaction', [
'contribution_status_id' => "Completed",
'contribution_recur_id' => $contributionRecur['id'],
]);
$this->assertEquals($repeatContribution['values'][$repeatContribution['id']]['source'], $templateContrib['values'][$templateContrib['id']]['source']);
}

/**
Expand Down

0 comments on commit 2e18711

Please sign in to comment.