From: Edsel Date: Mon, 15 Feb 2016 10:53:34 +0000 (+0530) Subject: CRM-16259 CIVI-3 Added extra check for proportional distribution of amounts of cancel... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2a84219e9c78d9cff4b8a370c0341a6b2c653274;p=civicrm-core.git CRM-16259 CIVI-3 Added extra check for proportional distribution of amounts of cancelled payments ---------------------------------------- * CRM-16259: Create Payment API https://issues.civicrm.org/jira/browse/CRM-16259 --- diff --git a/tests/phpunit/api/v3/PaymentTest.php b/tests/phpunit/api/v3/PaymentTest.php index 3ad33a7380..a5087f6c4f 100644 --- a/tests/phpunit/api/v3/PaymentTest.php +++ b/tests/phpunit/api/v3/PaymentTest.php @@ -394,6 +394,20 @@ class api_v3_PaymentTest extends CiviUnitTestCase { array_push(CRM_Core_Config::singleton()->userPermissionClass->permissions, 'access CiviCRM', 'edit contributions'); $payment = $this->callAPIAndDocument('payment', 'create', $params, __FUNCTION__, __FILE__); + // Check for proportional cancelled payment against lineitems. + $minParams = array( + 'entity_table' => 'civicrm_financial_item', + 'financial_trxn_id' => $payment['id'] - 1, + ); + + $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $minParams); + $amounts = array(-33.33, -16.67); + + foreach ($eft['values'] as $value) { + $this->assertEquals($value['amount'], array_pop($amounts)); + } + + // Check for proportional updated payment against lineitems. $params = array( 'entity_table' => 'civicrm_financial_item', 'financial_trxn_id' => $payment['id'],