From: Eileen McNaughton Date: Thu, 3 Mar 2016 11:16:18 +0000 (+1300) Subject: Merge pull request #7679 from JMAConsulting/CRM-16259-8 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=80d9f86f283306b93034f43b636a922a503ea710;p=civicrm-core.git Merge pull request #7679 from JMAConsulting/CRM-16259-8 CRM-16259 --- 80d9f86f283306b93034f43b636a922a503ea710 diff --cc tests/phpunit/api/v3/PaymentTest.php index e53a967b7d,a5087f6c4f..20dc98e5f6 --- a/tests/phpunit/api/v3/PaymentTest.php +++ b/tests/phpunit/api/v3/PaymentTest.php @@@ -405,8 -392,22 +405,22 @@@ class api_v3_PaymentTest extends CiviUn $payment = $this->callAPIFailure('payment', 'create', $params, 'API permission check failed for Payment/get call; insufficient permission: require access CiviCRM and edit contributions'); array_push(CRM_Core_Config::singleton()->userPermissionClass->permissions, 'access CiviCRM', 'edit contributions'); - $payment = $this->callAPIAndDocument('payment', 'create', $params, __FUNCTION__, __FILE__); + $payment = $this->callAPIAndDocument('payment', 'create', $params, __FUNCTION__, __FILE__, 'Update Payment', 'UpdatePayment'); + // 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'],