You are here

public function RouteGroupCacheContextTest::testGetContextNoGroup in Group 8

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

Tests getting the context value when there is no group on the route.

@covers ::getContext

File

tests/src/Unit/RouteGroupCacheContextTest.php, line 50

Class

RouteGroupCacheContextTest
Tests the route.group cache context.

Namespace

Drupal\Tests\group\Unit

Code

public function testGetContextNoGroup() {
  $this->currentRouteMatch
    ->getParameter('group')
    ->willReturn(NULL);
  $this->currentRouteMatch
    ->getRouteName()
    ->willReturn('foo');
  $cache_context = new RouteGroupCacheContext($this->currentRouteMatch
    ->reveal(), $this->entityTypeManager
    ->reveal());
  $this
    ->assertSame('group.none', $cache_context
    ->getContext());
}