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