You are here

public function GroupQueryAccessHandlerTest::testNoAccess in Group 8

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

Tests that the query has no results for people without any access.

@covers ::getConditions

File

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

Class

GroupQueryAccessHandlerTest
Tests the behavior of group query access handler.

Namespace

Drupal\Tests\group\Kernel

Code

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