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

CRM-20007 Add test to prove that repeatTransaction does not use the P… #9826

Merged
merged 3 commits into from
Feb 13, 2017
Merged
Changes from 1 commit
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
29 changes: 29 additions & 0 deletions tests/phpunit/api/v3/ContributionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3323,4 +3323,33 @@ protected function setUpForCompleteTransaction() {
return $contribution;
}

/**
* Test repeat contribution uses the Payment Processor' payment_instrument setting.
*/
public function testRepeatTransactionWithNonCreditCardDefault() {
$contributionRecur = $this->callAPISuccess('contribution_recur', 'create', array(
'contact_id' => $this->_individualId,
'installments' => '12',
'frequency_interval' => '1',
'amount' => '100',
'contribution_status_id' => 1,
'start_date' => '2012-01-01 00:00:00',
'currency' => 'USD',
'frequency_unit' => 'month',
'payment_processor_id' => $this->paymentProcessorID,
));
$contribution1 = $this->callAPISuccess('contribution', 'create', array_merge(
$this->_params,
array('contribution_recur_id' => $contributionRecur['id']))
);
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument('name');
$contribution2 = $this->callAPISuccess('contribution', 'repeattransaction', array(
'contribution_status_id' => 'Completed',
'trxn_id' => uniqid(),
'original_contribution_id' => $contribution1,
));
$this->assertEquals(array_search('Debit Card', $paymentInstruments), $contribution2['values'][$contribution2['id']]['payment_instrument_id']);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is what is used in the PaymentProcessor create in the test suite

$this->quickCleanUpFinancialEntities();
}

}