public function ModuleInstallerTest::testRouteRebuild in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php \Drupal\KernelTests\Core\Extension\ModuleInstallerTest::testRouteRebuild()
- 10 core/tests/Drupal/KernelTests/Core/Extension/ModuleInstallerTest.php \Drupal\KernelTests\Core\Extension\ModuleInstallerTest::testRouteRebuild()
Tests that routes are rebuilt during install and uninstall of modules.
@covers ::install @covers ::uninstall
File
- core/
tests/ Drupal/ KernelTests/ Core/ Extension/ ModuleInstallerTest.php, line 25
Class
- ModuleInstallerTest
- Tests the ModuleInstaller class.
Namespace
Drupal\KernelTests\Core\ExtensionCode
public function testRouteRebuild() {
// Remove the routing table manually to ensure it can be created lazily
// properly.
Database::getConnection()
->schema()
->dropTable('router');
$this->container
->get('module_installer')
->install([
'router_test',
]);
$route = $this->container
->get('router.route_provider')
->getRouteByName('router_test.1');
$this
->assertEquals('/router_test/test1', $route
->getPath());
$this->container
->get('module_installer')
->uninstall([
'router_test',
]);
$this
->expectException(RouteNotFoundException::class);
$this->container
->get('router.route_provider')
->getRouteByName('router_test.1');
}