add flush for cached payment processors
authorEileen McNaughton <eileen@fuzion.co.nz>
Tue, 27 Jan 2015 00:22:53 +0000 (13:22 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Tue, 27 Jan 2015 00:22:53 +0000 (13:22 +1300)
Civi/Payment/System.php
tests/phpunit/CiviTest/CiviUnitTestCase.php
tests/phpunit/api/v3/ContributionPageTest.php

index f4f2fede0cc2e39d6eedd0c6c34a03eca80228b8..29538b64bf7d95cf75d80186c5d33048faa09229 100644 (file)
@@ -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();
+  }
+
 }
index 0fdbf562baf07545b4b72555143f13d2a47d3d85..26f40ea2e68aeb00569ec671c8fdd021b19af72d 100755 (executable)
@@ -26,6 +26,8 @@
  *   <http://www.gnu.org/licenses/>.
  */
 
+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() {
index 7c2263f300a9da61793e28c79f90eeb16169ce38..fec64080e9db9d89398e2d5f0d9ed7cf62f3d489 100644 (file)
@@ -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
    */