You are here

public function QueryAccessHandlerTest::testAdmin in Entity API 8

@covers ::getConditions

File

tests/src/Kernel/QueryAccess/QueryAccessHandlerTest.php, line 69

Class

QueryAccessHandlerTest
Tests the query access handler.

Namespace

Drupal\Tests\entity\Kernel\QueryAccess

Code

public function testAdmin() {
  foreach ([
    'view',
    'update',
    'duplicate',
    'delete',
  ] as $operation) {
    $user = $this
      ->createUser([], [
      'administer entity_test_enhanced',
    ]);
    $conditions = $this->handler
      ->getConditions($operation, $user);
    $this
      ->assertEquals(0, $conditions
      ->count());
    $this
      ->assertEquals([
      'user.permissions',
    ], $conditions
      ->getCacheContexts());
    $this
      ->assertFalse($conditions
      ->isAlwaysFalse());
  }
}