function RoutePreloaderTest::testOnAlterRoutesWithAdminRoutes
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php \Drupal\Tests\Core\Routing\RoutePreloaderTest::testOnAlterRoutesWithAdminRoutes()
- 10 core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php \Drupal\Tests\Core\Routing\RoutePreloaderTest::testOnAlterRoutesWithAdminRoutes()
- 11.x core/tests/Drupal/Tests/Core/Routing/RoutePreloaderTest.php \Drupal\Tests\Core\Routing\RoutePreloaderTest::testOnAlterRoutesWithAdminRoutes()
Tests onAlterRoutes with just admin routes.
File
-
core/
tests/ Drupal/ Tests/ Core/ Routing/ RoutePreloaderTest.php, line 59
Class
- RoutePreloaderTest
- @coversDefaultClass \Drupal\Core\Routing\RoutePreloader @group Routing
Namespace
Drupal\Tests\Core\RoutingCode
public function testOnAlterRoutesWithAdminRoutes() {
$event = $this->getMockBuilder('Drupal\\Core\\Routing\\RouteBuildEvent')
->disableOriginalConstructor()
->getMock();
$route_collection = new RouteCollection();
$route_collection->add('test', new Route('/admin/foo', [
'_controller' => 'Drupal\\ExampleController',
]));
$route_collection->add('test2', new Route('/admin/bar', [
'_controller' => 'Drupal\\ExampleController',
]));
$event->expects($this->once())
->method('getRouteCollection')
->will($this->returnValue($route_collection));
$this->state
->expects($this->once())
->method('set')
->with('routing.non_admin_routes', []);
$this->preloader
->onAlterRoutes($event);
$this->preloader
->onFinishedRoutes(new Event());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.