You are here

public function OgRoleCacheContextTest::testNoMemberships in Organic groups 8

Same name in this branch
  1. 8 tests/src/Unit/Cache/Context/OgRoleCacheContextTest.php \Drupal\Tests\og\Unit\Cache\Context\OgRoleCacheContextTest::testNoMemberships()
  2. 8 tests/src/Kernel/Cache/Context/OgRoleCacheContextTest.php \Drupal\Tests\og\Kernel\Cache\Context\OgRoleCacheContextTest::testNoMemberships()

Tests generating of a cache context key for a user with no memberships.

This is a common case, e.g. for anonymous users.

@covers ::getContext

File

tests/src/Kernel/Cache/Context/OgRoleCacheContextTest.php, line 107

Class

OgRoleCacheContextTest
Tests the OG role cache context.

Namespace

Drupal\Tests\og\Kernel\Cache\Context

Code

public function testNoMemberships() : void {
  $user = User::getAnonymousUser();

  // The result should be the predefined 'NO_CONTEXT' value.
  $result = $this
    ->getContextResult($user);
  $this
    ->assertEquals(OgRoleCacheContext::NO_CONTEXT, $result);
}