public function RouterTest::testRouterUninstallInstall in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/system/src/Tests/Routing/RouterTest.php \Drupal\system\Tests\Routing\RouterTest::testRouterUninstallInstall()
Tests that routes no longer exist for a module that has been uninstalled.
File
- core/
modules/ system/ src/ Tests/ Routing/ RouterTest.php, line 268 - Contains \Drupal\system\Tests\Routing\RouterTest.
Class
- RouterTest
- Functional class for the full integrated routing system.
Namespace
Drupal\system\Tests\RoutingCode
public function testRouterUninstallInstall() {
\Drupal::service('module_installer')
->uninstall(array(
'router_test',
));
\Drupal::service('router.builder')
->rebuild();
try {
\Drupal::service('router.route_provider')
->getRouteByName('router_test.1');
$this
->fail('Route was delete on uninstall.');
} catch (RouteNotFoundException $e) {
$this
->pass('Route was delete on uninstall.');
}
// Install the module again.
\Drupal::service('module_installer')
->install(array(
'router_test',
));
\Drupal::service('router.builder')
->rebuild();
$route = \Drupal::service('router.route_provider')
->getRouteByName('router_test.1');
$this
->assertNotNull($route, 'Route exists after module installation');
}