/** * @param $permission * @param $hook */ public function setHookAndRequest($permission, $hook) { CRM_Core_Config::singleton()->userPermissionClass->permissions = (array) $permission; $this->hookClass->setHook('civicrm_aclGroup', array($this, $hook)); CRM_Contact_BAO_Group::getPermissionClause(TRUE); global $_REQUEST; $_REQUEST = $this->_params; }
/** * @dataProvider entities * Function tests that an empty where hook returns no results */ function testEntityGetNoResultsHook($entity) { $this->markTestIncomplete('hook acls only work with contacts so far'); CRM_Core_Config::singleton()->userPermissionClass->permissions = array(); $this->setUpEntities($entity); $this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookNoResults')); $result = $this->callAPISuccess($entity, 'get', array('check_permission' => 1)); $this->assertEquals(0, $result['count']); }