You are here

public function GroupQueryAccessHandlerTest::testBypassAccess in Group 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Kernel/GroupQueryAccessHandlerTest.php \Drupal\Tests\group\Kernel\GroupQueryAccessHandlerTest::testBypassAccess()

Tests that the the query is not altered for people who can bypass access.

@covers ::getConditions

File

tests/src/Kernel/GroupQueryAccessHandlerTest.php, line 39

Class

GroupQueryAccessHandlerTest
Tests the behavior of group query access handler.

Namespace

Drupal\Tests\group\Kernel

Code

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