| 1 entity_query.test | EntityFieldQueryTestCase::testEntityFieldQueryAccess() | 
Tests EntityFieldQuery access on non-node entities.
File
- core/modules/ entity/ tests/ entity_query.test, line 1526 
- Unit test file for the entity API.
Class
- EntityFieldQueryTestCase
- Tests EntityFieldQuery.
Code
function testEntityFieldQueryAccess() {
  // Test as a user with ability to bypass node access.
  $privileged_user = $this->backdropCreateUser(array('bypass node access', 'access content'));
  $this->backdropLogin($privileged_user);
  $this->backdropGet('entity-query-access/test/' . $this->fields[0]['field_name']);
  $this->assertText('Found entity', 'Returned access response with entities.');
  $this->backdropLogout();
  // Test as a user that does not have ability to bypass node access or view
  // all nodes.
  $regular_user = $this->backdropCreateUser(array('access content'));
  $this->backdropLogin($regular_user);
  $this->backdropGet('entity-query-access/test/' . $this->fields[0]['field_name']);
  $this->assertText('Found entity', 'Returned access response with entities.');
  $this->backdropLogout();
}
