Ornery test fix - more flushing of statics (#8172)
authorEileen McNaughton <eileen@mcnaughty.com>
Tue, 19 Apr 2016 09:23:29 +0000 (21:23 +1200)
committerEileen McNaughton <eileen@mcnaughty.com>
Tue, 19 Apr 2016 09:23:29 +0000 (21:23 +1200)
tests/phpunit/CRM/Financial/BAO/FinancialTypeTest.php
tests/phpunit/CiviTest/CiviUnitTestCase.php

index 3d91199538e10cbf855ff819573a18845758a509..6ab87869483f4caaac0cd262f011cfda260908ca 100644 (file)
@@ -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
index c5b2142e9bfc2ff7d6f893d577d5ff7750514e9f..8e87f506aa3191bb71e50fc5b1fd6c5efa404404 100644 (file)
@@ -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;
   }