From 4954339af383571470fcb20d28e67175374ce099 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 19 Apr 2016 21:23:29 +1200 Subject: [PATCH] Ornery test fix - more flushing of statics (#8172) --- tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php | 5 +---- tests/phpunit/CiviTest/CiviUnitTestCase.php | 7 +++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php b/tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php index 3d91199538..6ab8786948 100644 --- a/tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php +++ b/tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php @@ -131,7 +131,6 @@ class CRM_Financial_BAO_FinancialTypeTest extends CiviUnitTestCase { /** * Check method testGetAvailableFinancialTypes() - * @group ornery */ public function testGetAvailableFinancialTypes() { $this->setACL(); @@ -139,7 +138,7 @@ class CRM_Financial_BAO_FinancialTypeTest extends CiviUnitTestCase { 'view contributions of type Donation', 'view contributions of type Member Dues', )); - + $types = array(); CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($types); $expectedResult = array( 1 => "Donation", @@ -157,7 +156,6 @@ class CRM_Financial_BAO_FinancialTypeTest extends CiviUnitTestCase { /** * Check method testgetAvailableMembershipTypes() - * @group ornery */ public function testgetAvailableMembershipTypes() { // Create Membership types @@ -203,7 +201,6 @@ class CRM_Financial_BAO_FinancialTypeTest extends CiviUnitTestCase { /** * Check method testPermissionedFinancialTypes() - * @group ornery */ public function testPermissionedFinancialTypes() { // First get all core permissions diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index c5b2142e9b..8e87f506aa 100644 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -3446,7 +3446,14 @@ AND ( TABLE_NAME LIKE 'civicrm_value_%' ) if (isset(\Civi::$statics['CRM_Financial_BAO_FinancialType'])) { unset(\Civi::$statics['CRM_Financial_BAO_FinancialType']); } + if (isset(\Civi::$statics['CRM_Contribute_PseudoConstant'])) { + unset(\Civi::$statics['CRM_Contribute_PseudoConstant']); + } CRM_Contribute_PseudoConstant::flush('financialType'); + CRM_Contribute_PseudoConstant::flush('membershipType'); + // Pseudoconstants may be saved to the cache table. + CRM_Core_DAO::executeQuery("TRUNCATE civicrm_cache"); + CRM_Financial_BAO_FinancialType::$_statusACLFt = array(); CRM_Financial_BAO_FinancialType::$_availableFinancialTypes = NULL; } -- 2.25.1