From: Eileen McNaughton Date: Thu, 12 Feb 2015 05:40:10 +0000 (+1300) Subject: CRM-15960 test X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2936c3b503ba4b4b625a17ebacceed606181f3a2;p=civicrm-core.git CRM-15960 test --- diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index 6f81b00bb5..c35994f60a 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -1323,6 +1323,22 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $mut->stop(); } + /** + * Test completing a transaction does not 'mess' with net amount (CRM-15960). + */ + public function testCompleteTransactionNetAmountOK() { + $this->createLoggedInUser(); + $params = array_merge($this->_params, array('contribution_status_id' => 2)); + unset($params['net_amount']); + $contribution = $this->callAPISuccess('contribution', 'create', $params); + $this->callAPISuccess('contribution', 'completetransaction', array( + 'id' => $contribution['id'], + )); + $contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $contribution['id'])); + $this->assertEquals('Completed', $contribution['contribution_status']); + $this->assertTrue(($contribution['total_amount'] - $contribution['net_amount']) == $contribution['fee_amount']); + } + /** * CRM-14151 * Test completing a transaction via the API