From 6d8a45ed626cd8f7ef455540ed3f85e4078003f7 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sun, 19 Oct 2014 21:11:38 +1300 Subject: [PATCH] to get tests to pass add a hack-around to allow us to clear static var --- CRM/Member/BAO/Membership.php | 7 ++++++- tests/phpunit/CiviTest/CiviUnitTestCase.php | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CRM/Member/BAO/Membership.php b/CRM/Member/BAO/Membership.php index faa3682c10..c6026d47e6 100644 --- a/CRM/Member/BAO/Membership.php +++ b/CRM/Member/BAO/Membership.php @@ -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; diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index 85b165f58d..f8959c8da9 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -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() { -- 2.25.1