From 02a9c0a4e9eaada14f3ebe362f59304572b57aca Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Tue, 4 Jul 2017 17:08:00 +0530 Subject: [PATCH] test failure fixes --- tests/phpunit/api/v3/ContributionTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index 3317805d18..2b8239ba18 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -1148,6 +1148,9 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $contribution = $this->callAPISuccess('contribution', 'create', $newParams); $this->assertAPISuccess($contribution); $this->_checkFinancialTrxn($contribution, 'paymentInstrument', $instrumentId); + + // cleanup - delete created payment instrument + $this->_deletedAddedPaymentInstrument(); } /** @@ -1173,6 +1176,9 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $contribution = $this->callAPISuccess('contribution', 'create', $newParams); $this->assertAPISuccess($contribution); $this->_checkFinancialTrxn($contribution, 'paymentInstrument', $instrumentId, array('total_amount' => '-100.00')); + + // cleanup - delete created payment instrument + $this->_deletedAddedPaymentInstrument(); } /** @@ -3428,6 +3434,18 @@ class api_v3_ContributionTest extends CiviUnitTestCase { return $optionValue['values'][$optionValue['id']]['value']; } + public function _deletedAddedPaymentInstrument() { + $result = $this->callAPISuccess('OptionValue', 'get', array( + 'option_group_id' => 'payment_instrument', + 'name' => 'Test Card', + 'value' => '6', + 'is_active' => 1, + )); + if ($id = CRM_Utils_Array::value('id', $result)) { + $this->callAPISuccess('OptionValue', 'delete', array('id' => $id)); + } + } + /** * Set up the basic recurring contribution for tests. * -- 2.25.1