public function IsGroupMemberCacheContextTest::testGetContextWithoutId in Group 8
Same name and namespace in other branches
- 2.0.x tests/src/Unit/IsGroupMemberCacheContextTest.php \Drupal\Tests\group\Unit\IsGroupMemberCacheContextTest::testGetContextWithoutId()
Tests getting the context value from a non-calculated cache context.
@covers ::getContext
File
- tests/
src/ Unit/ IsGroupMemberCacheContextTest.php, line 53
Class
- IsGroupMemberCacheContextTest
- Tests the user.is_group_member:%group_id cache context.
Namespace
Drupal\Tests\group\UnitCode
public function testGetContextWithoutId() {
$cache_context = new IsGroupMemberCacheContext($this->currentUser, $this
->createEntityTypeManager(1)
->reveal(), $this
->createGroupMembershipLoader(FALSE)
->reveal());
$this
->expectException(\LogicException::class);
$this
->expectExceptionMessage('No group ID provided for user.is_group_member cache context.');
$cache_context
->getContext();
}