You are here

public function UncacheableQueryAccessHandlerTest::testNoAccess in Entity API 8

@covers ::getConditions

File

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

Class

UncacheableQueryAccessHandlerTest
Tests the uncacheable query access handler.

Namespace

Drupal\Tests\entity\Kernel\QueryAccess

Code

public function testNoAccess() {
  foreach ([
    'view',
    'update',
    '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());
  }
}