function EntityFieldQueryTestCase::testEntityFieldQueryAccess
Tests EntityFieldQuery access on non-node entities.
File
-
modules/
simpletest/ tests/ entity_query.test, line 1616
Class
- EntityFieldQueryTestCase
- Tests EntityFieldQuery.
Code
function testEntityFieldQueryAccess() {
// Test as a user with ability to bypass node access.
$privileged_user = $this->drupalCreateUser(array(
'bypass node access',
'access content',
));
$this->drupalLogin($privileged_user);
$this->drupalGet('entity-query-access/test/' . $this->fields[0]['field_name']);
$this->assertText('Found entity', 'Returned access response with entities.');
$this->drupalLogout();
// Test as a user that does not have ability to bypass node access or view
// all nodes.
$regular_user = $this->drupalCreateUser(array(
'access content',
));
$this->drupalLogin($regular_user);
$this->drupalGet('entity-query-access/test/' . $this->fields[0]['field_name']);
$this->assertText('Found entity', 'Returned access response with entities.');
$this->drupalLogout();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.