function WorkspaceRequestSubscriberTest::testOnKernelRequestWithCacheableRouteProvider

Same name and namespace in other branches
  1. 9 core/modules/workspaces/tests/src/Unit/WorkspaceRequestSubscriberTest.php \Drupal\Tests\workspaces\Unit\WorkspaceRequestSubscriberTest::testOnKernelRequestWithCacheableRouteProvider()
  2. 8.9.x core/modules/workspaces/tests/src/Unit/WorkspaceRequestSubscriberTest.php \Drupal\Tests\workspaces\Unit\WorkspaceRequestSubscriberTest::testOnKernelRequestWithCacheableRouteProvider()
  3. 11.x core/modules/workspaces/tests/src/Unit/WorkspaceRequestSubscriberTest.php \Drupal\Tests\workspaces\Unit\WorkspaceRequestSubscriberTest::testOnKernelRequestWithCacheableRouteProvider()

@covers ::onKernelRequest

File

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

Class

WorkspaceRequestSubscriberTest
@coversDefaultClass \Drupal\workspaces\EventSubscriber\WorkspaceRequestSubscriber[[api-linebreak]]

Namespace

Drupal\Tests\workspaces\Unit

Code

public function testOnKernelRequestWithCacheableRouteProvider() : void {
  $route_provider = $this->prophesize(CacheableRouteProviderInterface::class);
  $route_provider->addExtraCacheKeyPart('workspace', 'test')
    ->shouldBeCalled();
  // Check that WorkspaceRequestSubscriber::onKernelRequest() calls
  // addExtraCacheKeyPart() on a route provider that implements
  // CacheableRouteProviderInterface.
  $workspace_request_subscriber = new WorkspaceRequestSubscriber($route_provider->reveal(), $this->workspaceManager
    ->reveal());
  $event = $this->prophesize(RequestEvent::class)
    ->reveal();
  $this->assertNull($workspace_request_subscriber->onKernelRequest($event));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.