You are here

public function GroupPermissionsCacheContextTest::testGetContext in Group 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Unit/GroupPermissionsCacheContextTest.php \Drupal\Tests\group\Unit\GroupPermissionsCacheContextTest::testGetContext()

Tests getting the context value for the current user.

@covers ::getContext

File

tests/src/Unit/GroupPermissionsCacheContextTest.php, line 47

Class

GroupPermissionsCacheContextTest
Tests the user.group_permissions cache context.

Namespace

Drupal\Tests\group\Unit

Code

public function testGetContext() {
  $this->permissionsHashGenerator
    ->generateHash($this->currentUser
    ->reveal())
    ->willReturn('foo');
  $cache_context = new GroupPermissionsCacheContext($this->currentUser
    ->reveal(), $this->permissionsHashGenerator
    ->reveal());
  $this
    ->assertSame('foo', $cache_context
    ->getContext(), 'The cache context gets its value directly from the hash generator.');
}