public function IsGroupMemberCacheContextTest::testGetCacheableMetadataWithoutId in Group 8
Same name and namespace in other branches
- 2.0.x tests/src/Unit/IsGroupMemberCacheContextTest.php \Drupal\Tests\group\Unit\IsGroupMemberCacheContextTest::testGetCacheableMetadataWithoutId()
Tests getting the cacheable metadata from a non-calculated cache context.
@covers ::getCacheableMetadata
File
- tests/
src/ Unit/ IsGroupMemberCacheContextTest.php, line 115
Class
- IsGroupMemberCacheContextTest
- Tests the user.is_group_member:%group_id cache context.
Namespace
Drupal\Tests\group\UnitCode
public function testGetCacheableMetadataWithoutId() {
$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
->getCacheableMetadata();
}