public function RouteParamContextTest::testOnPageContextEmpty in Page Manager 8
Same name and namespace in other branches
- 8.4 tests/src/Unit/RouteParamContextTest.php \Drupal\Tests\page_manager\Unit\RouteParamContextTest::testOnPageContextEmpty()
@covers ::onPageContext
File
- tests/
src/ Unit/ RouteParamContextTest.php, line 94 - Contains \Drupal\Tests\page_manager\Unit\RouteParamContextTest.
Class
- RouteParamContextTest
- Tests the route param context.
Namespace
Drupal\Tests\page_manager\UnitCode
public function testOnPageContextEmpty() {
$collection = new RouteCollection();
$route_provider = $this
->prophesize(RouteProviderInterface::class);
$route_provider
->getRoutesByPattern('/test_route')
->willReturn($collection);
$request = new Request();
$request_stack = new RequestStack();
$request_stack
->push($request);
$this->page
->getPath()
->willReturn('/test_route');
$this->page
->addContext(Argument::cetera())
->shouldNotBeCalled();
// Set up a request with one of the expected parameters as an attribute.
$request->attributes
->add([
'foo' => 'banana',
]);
$route_param_context = new RouteParamContext($route_provider
->reveal(), $request_stack);
$route_param_context
->onPageContext($this->event);
}