function RouterTest::testRouterUninstallInstall
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Routing/RouterTest.php \Drupal\Tests\system\Functional\Routing\RouterTest::testRouterUninstallInstall()
- 8.9.x core/modules/system/tests/src/Functional/Routing/RouterTest.php \Drupal\Tests\system\Functional\Routing\RouterTest::testRouterUninstallInstall()
- 11.x core/modules/system/tests/src/Functional/Routing/RouterTest.php \Drupal\Tests\system\Functional\Routing\RouterTest::testRouterUninstallInstall()
Tests that routes no longer exist for a module that has been uninstalled.
File
-
core/
modules/ system/ tests/ src/ Functional/ Routing/ RouterTest.php, line 310
Class
- RouterTest
- Functional class for the full integrated routing system.
Namespace
Drupal\Tests\system\Functional\RoutingCode
public function testRouterUninstallInstall() : void {
\Drupal::service('module_installer')->uninstall([
'router_test',
]);
try {
\Drupal::service('router.route_provider')->getRouteByName('router_test.1');
$this->fail('Route was delete on uninstall.');
} catch (RouteNotFoundException $e) {
// Expected exception; just continue testing.
}
// Install the module again.
\Drupal::service('module_installer')->install([
'router_test',
]);
$route = \Drupal::service('router.route_provider')->getRouteByName('router_test.1');
$this->assertNotNull($route, 'Route exists after module installation');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.