function MockRouteProvider::getRouteByName
Same name in other branches
- 9 core/modules/system/src/Tests/Routing/MockRouteProvider.php \Drupal\system\Tests\Routing\MockRouteProvider::getRouteByName()
- 8.9.x core/modules/system/src/Tests/Routing/MockRouteProvider.php \Drupal\system\Tests\Routing\MockRouteProvider::getRouteByName()
- 11.x core/modules/system/src/Tests/Routing/MockRouteProvider.php \Drupal\system\Tests\Routing\MockRouteProvider::getRouteByName()
File
-
core/
modules/ system/ src/ Tests/ Routing/ MockRouteProvider.php, line 47
Class
- MockRouteProvider
- Easily configurable mock route provider.
Namespace
Drupal\system\Tests\RoutingCode
public function getRouteByName($name) {
$routes = $this->getRoutesByNames([
$name,
]);
if (empty($routes)) {
throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', $name));
}
return reset($routes);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.