You are here

public function UncacheableQueryAccessHandlerTest::testAdmin in Entity API 8

@covers ::getConditions

File

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

Class

UncacheableQueryAccessHandlerTest
Tests the uncacheable query access handler.

Namespace

Drupal\Tests\entity\Kernel\QueryAccess

Code

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