/**
* @var string|bool
*/
- public $checkPermissions;
+ protected $checkPermissions;
protected $apiVersion;
/**
* @param string $entity
+ * @param bool $checkPermissions
*/
- public function __construct($entity) {
+ public function __construct($entity, $checkPermissions) {
$this->entity = $entity;
require_once 'api/v3/utils.php';
$baoName = _civicrm_api3_get_BAO($entity);
$bao->free();
// Add ACLs first to avoid redundant subclauses
+ $this->checkPermissions = $checkPermissions;
$this->query->where($this->getAclClause(self::MAIN_TABLE_ALIAS, $baoName));
}
* @package Civi\Test
*
* To run your test against a fake, headless database, flag it with the
- * HeadlessInterface. CiviTestListener will automatically boot
+ * HeadlessInterface. CiviTestListener will automatically boot Civi.
*
* Alternatively, if you wish to run a test in a live (CMS-enabled) environment,
* flag it with EndToEndInterface.
interface HeadlessInterface {
/**
- * The setupHeadless functions runs at the start of each test case, right before
+ * The setupHeadless function runs at the start of each test case, right before
* the headless environment reboots.
*
* It should perform any necessary steps required for putting the database
$entity = CRM_Core_DAO_AllCoreTables::getBriefName(str_replace('_BAO_', '_DAO_', $bao_name));
$options = _civicrm_api3_get_options_from_params($params);
- $query = new \Civi\API\Api3SelectQuery($entity);
+ $query = new \Civi\API\Api3SelectQuery($entity, CRM_Utils_Array::value('check_permissions', $params, FALSE));
$query->where = $params;
if ($options['is_count']) {
$query->select = array('count');
}
$query->limit = $options['limit'];
$query->offset = $options['offset'];
- $query->checkPermissions = CRM_Utils_Array::value('check_permissions', $params, FALSE);
$query->merge($sql);
$result = $query->run();