You are here

public function QueryAccessHandlerTest::testNoAccess in Entity API 8

@covers ::getConditions

File

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

Class

QueryAccessHandlerTest
Tests the query access handler.

Namespace

Drupal\Tests\entity\Kernel\QueryAccess

Code

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