function CurrentRouteMatchTest::getRouteMatch
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Routing/CurrentRouteMatchTest.php \Drupal\Tests\Core\Routing\CurrentRouteMatchTest::getRouteMatch()
- 10 core/tests/Drupal/Tests/Core/Routing/CurrentRouteMatchTest.php \Drupal\Tests\Core\Routing\CurrentRouteMatchTest::getRouteMatch()
- 11.x core/tests/Drupal/Tests/Core/Routing/CurrentRouteMatchTest.php \Drupal\Tests\Core\Routing\CurrentRouteMatchTest::getRouteMatch()
Overrides RouteMatchTestBase::getRouteMatch
File
-
core/
tests/ Drupal/ Tests/ Core/ Routing/ CurrentRouteMatchTest.php, line 21
Class
- CurrentRouteMatchTest
- @coversDefaultClass \Drupal\Core\Routing\CurrentRouteMatch @group Routing
Namespace
Drupal\Tests\Core\RoutingCode
protected function getRouteMatch($name, Route $route, array $parameters, array $raw_parameters) {
$request_stack = new RequestStack();
$request = new Request();
$request_stack->push($request);
$request = $request_stack->getCurrentRequest();
$request->attributes = new ParameterBag($parameters);
$request->attributes
->set(RouteObjectInterface::ROUTE_NAME, $name);
$request->attributes
->set(RouteObjectInterface::ROUTE_OBJECT, $route);
$request->attributes
->set('_raw_variables', new ParameterBag($raw_parameters));
return new CurrentRouteMatch($request_stack);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.