Skip to content

Commit

Permalink
CRM-20158, added test
Browse files Browse the repository at this point in the history
----------------------------------------
* CRM-20158: Store card type and last 4 digits of credit card
  https://issues.civicrm.org/jira/browse/CRM-20158
  • Loading branch information
pradpnayak committed Feb 22, 2017
1 parent 597472c commit 70dd7fc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/phpunit/CRM/Core/BAO/FinancialTrxnTest.php
Expand Up @@ -171,4 +171,25 @@ public function testCreateDeferredTrxn() {
$this->assertEquals(date('Ymd', strtotime($trxn['values'][$trxn['id']]['trxn_date'])), date('Ymd', strtotime("+1 month")));
}

/**
* Test for hasPaymentProcessorTrxn().
*/
public function testHasPaymentProcessorTrxn() {
$cid = $this->individualCreate();
$paymentProcessorID = $this->processorCreate();
$params = array(
'contact_id' => $cid,
'receive_date' => '2016-01-20',
'total_amount' => 100,
'financial_type_id' => 1,
);
$contribution = CRM_Contribute_BAO_Contribution::create($params);
$paymentProcessorId = CRM_Core_BAO_FinancialTrxn::hasPaymentProcessorTrxn($contribution->id);
$this->assertEquals($paymentProcessorId, NULL);
$params['payment_processor'] = $paymentProcessorID;
$contribution = CRM_Contribute_BAO_Contribution::create($params);
$paymentProcessorId = CRM_Core_BAO_FinancialTrxn::hasPaymentProcessorTrxn($contribution->id);
$this->assertEquals($paymentProcessorId, $paymentProcessorID);
}

}

0 comments on commit 70dd7fc

Please sign in to comment.