You are here

public function GroupContentQueryAccessHandlerTest::testBypassAccess in Group 2.0.x

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

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

@covers ::getConditions

File

tests/src/Kernel/GroupContentQueryAccessHandlerTest.php, line 72

Class

GroupContentQueryAccessHandlerTest
Tests the behavior of group content 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
      ->assertEqualsCanonicalizing([
      'user.permissions',
    ], $conditions
      ->getCacheContexts());
    $this
      ->assertFalse($conditions
      ->isAlwaysFalse());
  }
}