You are here

public function IsGroupMemberCacheContextTest::testGetContextNotMember in Group 8

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

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

@covers ::getContext

File

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

Class

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

Namespace

Drupal\Tests\group\Unit

Code

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