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;
public $setupIDs = array();
/**
- * PHPUnit Mock Mecthod to use.
+ * PHPUnit Mock Method to use.
*
* @var string
*/
);
}
+ /**
+ * 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
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.
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);
}
}
$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