You are here

public function WorkspaceRequestSubscriberTest::testOnKernelRequestWithoutCacheableRouteProvider in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/workspaces/tests/src/Unit/WorkspaceRequestSubscriberTest.php \Drupal\Tests\workspaces\Unit\WorkspaceRequestSubscriberTest::testOnKernelRequestWithoutCacheableRouteProvider()

@covers ::onKernelRequest

File

core/modules/workspaces/tests/src/Unit/WorkspaceRequestSubscriberTest.php, line 71

Class

WorkspaceRequestSubscriberTest
@coversDefaultClass \Drupal\workspaces\EventSubscriber\WorkspaceRequestSubscriber

Namespace

Drupal\Tests\workspaces\Unit

Code

public function testOnKernelRequestWithoutCacheableRouteProvider() {
  $route_provider = $this
    ->prophesize(RouteProviderInterface::class);

  // Check that WorkspaceRequestSubscriber::onKernelRequest() doesn't call
  // addExtraCacheKeyPart() on a route provider that does not implement
  // CacheableRouteProviderInterface.
  $workspace_request_subscriber = new WorkspaceRequestSubscriber($this->aliasManager, $this->currentPath, $route_provider
    ->reveal(), $this->workspaceManager
    ->reveal());
  $event = $this
    ->prophesize(GetResponseEvent::class)
    ->reveal();
  $this
    ->assertNull($workspace_request_subscriber
    ->onKernelRequest($event));
}