public function RouteGroupCacheContextTest::testGetContextWithGroup in Group 8
Same name and namespace in other branches
- 2.0.x tests/src/Unit/RouteGroupCacheContextTest.php \Drupal\Tests\group\Unit\RouteGroupCacheContextTest::testGetContextWithGroup()
Tests getting the context value when there is a group on the route.
@covers ::getContext
File
- tests/
src/ Unit/ RouteGroupCacheContextTest.php, line 63
Class
- RouteGroupCacheContextTest
- Tests the route.group cache context.
Namespace
Drupal\Tests\group\UnitCode
public function testGetContextWithGroup() {
$group = $this
->prophesize(GroupInterface::class);
$group
->id()
->willReturn(1);
$this->currentRouteMatch
->getParameter('group')
->willReturn($group
->reveal());
$cache_context = new RouteGroupCacheContext($this->currentRouteMatch
->reveal(), $this->entityTypeManager
->reveal());
$this
->assertSame(1, $cache_context
->getContext());
}