public function WorkspaceRequestSubscriberTest::testOnKernelRequestWithCacheableRouteProvider in Drupal 8
Same name and namespace in other branches
- 9 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 56
Class
- WorkspaceRequestSubscriberTest
- @coversDefaultClass \Drupal\workspaces\EventSubscriber\WorkspaceRequestSubscriber
Namespace
Drupal\Tests\workspaces\UnitCode
public function testOnKernelRequestWithCacheableRouteProvider() {
$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($this->aliasManager, $this->currentPath, $route_provider
->reveal(), $this->workspaceManager
->reveal());
$event = $this
->prophesize(GetResponseEvent::class)
->reveal();
$this
->assertNull($workspace_request_subscriber
->onKernelRequest($event));
}