ACL Core, add a way for unit tests to flush in-function cache
authorEileen McNaughton <eileen@fuzion.co.nz>
Fri, 31 Jan 2014 05:10:04 +0000 (18:10 +1300)
committerEileen McNaughton <eileen@fuzion.co.nz>
Sun, 27 Apr 2014 23:59:05 +0000 (16:59 -0700)
CRM/ACL/API.php

index d81259b7b4d1dc8bef1a8ff0948ed196e0ac3af6..8463f8b265e421d7d509a6867e0ef297c7264779 100644 (file)
@@ -178,10 +178,17 @@ class CRM_ACL_API {
     $contactID      = NULL,
     $tableName      = 'civicrm_saved_search',
     $allGroups      = NULL,
-    $includedGroups = NULL
+    $includedGroups = NULL,
+    $flush = FALSE
   ) {
-    static $cache = array();
 
+    static $cache = array();
+    //@todo this is pretty hacky!!!
+    //adding a way for unit tests to flush the cache
+    if ($flush) {
+      $cache = array();
+      return;
+    }
     if (!$contactID) {
       $session = CRM_Core_Session::singleton();
       $contactID = NULL;