to get tests to pass add a hack-around to allow us to clear static var
authorEileen McNaughton <eileen@fuzion.co.nz>
Sun, 19 Oct 2014 08:11:38 +0000 (21:11 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Sun, 19 Oct 2014 08:11:38 +0000 (21:11 +1300)
CRM/Member/BAO/Membership.php
tests/phpunit/CiviTest/CiviUnitTestCase.php

index faa3682c10bc00981f7dbbff1657f575b6793ef9..c6026d47e691f264372f613ab1ff4b3495e8d2c7 100644 (file)
@@ -1704,8 +1704,13 @@ WHERE  civicrm_membership.contact_id = civicrm_contact.id
    * @static
    * @access public
    */
-  static function createRelatedMemberships(&$params, &$dao) {
+  static function createRelatedMemberships(&$params, &$dao, $reset = FALSE) {
     static $relatedContactIds = array();
+    if ($reset) {
+      // not sure why a static var is in use here - we need a way to reset it from the test suite
+      $relatedContactIds = array();
+      return;
+    }
 
     $membership = new CRM_Member_DAO_Membership();
     $membership->id = $dao->id;
index 85b165f58d420ce540735adda19844ba5da8b332..f8959c8da9b63ed6e35a610b8be47ac4b67ddd27 100644 (file)
@@ -2390,6 +2390,8 @@ AND    ( TABLE_NAME LIKE 'civicrm_value_%' )
     $this->quickCleanup($tablesToTruncate);
     CRM_Core_DAO::executeQuery("DELETE FROM civicrm_membership_status WHERE name NOT IN('New', 'Current', 'Grace', 'Expired', 'Pending', 'Cancelled', 'Deceased')");
     $this->restoreDefaultPriceSetConfig();
+    $var = TRUE;
+    CRM_Member_BAO_Membership::createRelatedMemberships($var, $var, TRUE);
   }
 
   function restoreDefaultPriceSetConfig() {