From 2936c3b503ba4b4b625a17ebacceed606181f3a2 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 12 Feb 2015 18:40:10 +1300 Subject: [PATCH] CRM-15960 test --- tests/phpunit/api/v3/ContributionTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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 -- 2.25.1