From 1fee3ad2c4e5ea614bbe2d7c0c6dc0762cb016d5 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 27 Jan 2015 13:22:53 +1300 Subject: [PATCH] add flush for cached payment processors --- Civi/Payment/System.php | 10 ++++++++++ tests/phpunit/CiviTest/CiviUnitTestCase.php | 3 +++ tests/phpunit/api/v3/ContributionPageTest.php | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Civi/Payment/System.php b/Civi/Payment/System.php index f4f2fede0c..29538b64bf 100644 --- a/Civi/Payment/System.php +++ b/Civi/Payment/System.php @@ -77,4 +77,14 @@ class System { return self::getByProcessor($processor); } + /** + * Flush processors from static cache. + * + * This is particularly used for tests. + * + */ + public function flushProcessors() { + $this->cache = array(); + } + } diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 0fdbf562ba..26f40ea2e6 100755 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -26,6 +26,8 @@ * . */ +use Civi\Payment\System; + /** * Include configuration */ @@ -2580,6 +2582,7 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) $this->restoreDefaultPriceSetConfig(); $var = TRUE; CRM_Member_BAO_Membership::createRelatedMemberships($var, $var, TRUE); + Civi\Payment\System::singleton()->flushProcessors(); } public function restoreDefaultPriceSetConfig() { diff --git a/tests/phpunit/api/v3/ContributionPageTest.php b/tests/phpunit/api/v3/ContributionPageTest.php index 7c2263f300..fec64080e9 100644 --- a/tests/phpunit/api/v3/ContributionPageTest.php +++ b/tests/phpunit/api/v3/ContributionPageTest.php @@ -258,7 +258,7 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase { /** * Test submit recurring membership with immediate confirmation (IATS style) * - we process 2 membership transactions against with a recurring contribution against a contribution page with an immediate - * processor (IASTS style - denoted by returning trxn_id) + * processor (IATS style - denoted by returning trxn_id) * - the first creates a new membership, completed contribution, in progress recurring. Check these * - create another - end date should be extended */ -- 2.25.1