You are here

public function IsGroupMemberCacheContextTest::testGetContextMember in Group 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/IsGroupMemberCacheContextTest.php \Drupal\Tests\group\Unit\IsGroupMemberCacheContextTest::testGetContextMember()

Tests getting the context value when the user is a member.

@covers ::getContext

File

tests/src/Unit/IsGroupMemberCacheContextTest.php, line 87

Class

IsGroupMemberCacheContextTest
Tests the user.is_group_member:%group_id cache context.

Namespace

Drupal\Tests\group\Unit

Code

public function testGetContextMember() {
  $cache_context = new IsGroupMemberCacheContext($this->currentUser, $this
    ->createEntityTypeManager(1)
    ->reveal(), $this
    ->createGroupMembershipLoader(TRUE)
    ->reveal());
  $this
    ->assertSame('1', $cache_context
    ->getContext(1));
}