From d934a732dff2bfe5111597b59257f1735b2ca493 Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Mon, 26 Dec 2016 00:47:41 +0530 Subject: [PATCH] CRM-19800, added test ---------------------------------------- * CRM-19800: Incorrect Amount recorded in civicrm_financial_trxn table https://issues.civicrm.org/jira/browse/CRM-19800 --- .../CRM/Contribute/BAO/ContributionTest.php | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php index 54dc980092..d2f13ef415 100644 --- a/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/BAO/ContributionTest.php @@ -1038,4 +1038,35 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2"; } } + /** + * Test recording of amount with comma separator. + */ + public function testCommaSeparatorAmount() { + $contactId = $this->individualCreate(); + + $params = array( + 'contact_id' => $contactId, + 'currency' => 'USD', + 'financial_type_id' => 1, + 'contribution_status_id' => 8, + 'payment_instrument_id' => 1, + 'receive_date' => '20080522000000', + 'receipt_date' => '20080522000000', + 'total_amount' => '20000.00', + 'partial_payment_total' => '20,000.00', + 'partial_amount_pay' => '8,000.00', + ); + + $contribution = CRM_Contribute_BAO_Contribution::create($params); + $lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contribution->id, 'DESC'); + $financialTrxn = $this->callAPISuccessGetSingle( + 'FinancialTrxn', + array( + 'id' => $lastFinancialTrxnId['financialTrxnId'], + 'return' => array('total_amount'), + ) + ); + $this->assertEquals($financialTrxn['total_amount'], 8000, 'Invalid Tax amount.'); + } + } -- 2.25.1