Merge pull request #13517 from alifrumin/contribsearchsoftcredit
[civicrm-core.git] / tests / phpunit / CiviTest / CiviUnitTestCase.php
index 76a9d3f5c7553f5f337d64dd19c51a064228e9d8..50e363fc40a4d4f320e39758d9a73abf1927f8f8 100644 (file)
@@ -114,9 +114,13 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
   private $tx = NULL;
 
   /**
-   * @var CRM_Utils_Hook_UnitTests hookClass
-   * example of setting a method for a hook
+   * Class used for hooks during tests.
+   *
+   * This can be used to test hooks within tests. For example in the ACL_PermissionTrait:
+   *
    * $this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookAllResults'));
+   *
+   * @var CRM_Utils_Hook_UnitTests hookClass
    */
   public $hookClass = NULL;
 
@@ -140,7 +144,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
   public $setupIDs = array();
 
   /**
-   * PHPUnit Mock Mecthod to use.
+   * PHPUnit Mock Method to use.
    *
    * @var string
    */
@@ -684,6 +688,20 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
     );
   }
 
+  /**
+   * Assert the 2 arrays have the same values.
+   *
+   * @param array $array1
+   * @param array $array2
+   */
+  public function assertArrayValuesEqual($array1, $array2) {
+    $array1 = array_values($array1);
+    $array2 = array_values($array2);
+    sort($array1);
+    sort($array2);
+    $this->assertEquals($array1, $array2);
+  }
+
   /**
    * @param $expected
    * @param $actual
@@ -1712,27 +1730,6 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
     return $result;
   }
 
-  /**
-   * Delete a UF Join Entry.
-   *
-   * @param array $params
-   *   with missing uf_group_id
-   */
-  public function ufjoinDelete($params = NULL) {
-    if ($params === NULL) {
-      $params = array(
-        'is_active' => 1,
-        'module' => 'CiviEvent',
-        'entity_table' => 'civicrm_event',
-        'entity_id' => 3,
-        'weight' => 1,
-        'uf_group_id' => '',
-      );
-    }
-
-    crm_add_uf_join($params);
-  }
-
   /**
    * @param array $params
    *   Optional parameters.
@@ -2730,7 +2727,7 @@ AND    ( TABLE_NAME LIKE 'civicrm_value_%' )
     if (!$isProfile) {
       //flush cache
       CRM_ACL_BAO_Cache::resetCache();
-      CRM_ACL_API::groupPermission('whatever', 9999, NULL, 'civicrm_saved_search', NULL, NULL, TRUE);
+      CRM_ACL_API::groupPermission('whatever', 9999, NULL, 'civicrm_saved_search', NULL, NULL);
     }
   }
 
@@ -3563,20 +3560,6 @@ AND    ( TABLE_NAME LIKE 'civicrm_value_%' )
     $this->_ids['membership_type'] = $membershipTypeID;
   }
 
-  /**
-   * No results returned.
-   *
-   * @implements CRM_Utils_Hook::aclWhereClause
-   *
-   * @param string $type
-   * @param array $tables
-   * @param array $whereTables
-   * @param int $contactID
-   * @param string $where
-   */
-  public function aclWhereHookNoResults($type, &$tables, &$whereTables, &$contactID, &$where) {
-  }
-
   /**
    * Only specified contact returned.
    * @implements CRM_Utils_Hook::aclWhereClause