summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/core.services.yml14
-rw-r--r--core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php5
-rw-r--r--core/lib/Drupal/Core/Extension/ModuleInstaller.php8
-rw-r--r--core/lib/Drupal/Core/Extension/ThemeHandler.php22
-rw-r--r--core/lib/Drupal/Core/Menu/LocalTaskManager.php3
-rw-r--r--core/lib/Drupal/Core/Routing/RouteBuilder.php45
-rw-r--r--core/lib/Drupal/Core/Routing/RouteBuilderIndicator.php55
-rw-r--r--core/lib/Drupal/Core/Routing/RouteBuilderIndicatorInterface.php39
-rw-r--r--core/lib/Drupal/Core/Routing/RouteProvider.php24
-rw-r--r--core/modules/book/src/Tests/BookUninstallTest.php1
-rw-r--r--core/modules/breakpoint/src/Tests/BreakpointDiscoveryTest.php3
-rw-r--r--core/modules/ckeditor/src/Tests/CKEditorTest.php1
-rw-r--r--core/modules/comment/src/Tests/CommentStringIdEntitiesTest.php2
-rw-r--r--core/modules/config/src/Tests/ConfigCRUDTest.php5
-rw-r--r--core/modules/config/src/Tests/DefaultConfigTest.php1
-rw-r--r--core/modules/content_translation/content_translation.admin.inc2
-rw-r--r--core/modules/content_translation/content_translation.module2
-rw-r--r--core/modules/field/src/Tests/FieldAttachOtherTest.php1
-rw-r--r--core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php1
-rw-r--r--core/modules/field/src/Tests/FieldUnitTestBase.php1
-rw-r--r--core/modules/field_ui/field_ui.module12
-rw-r--r--core/modules/field_ui/src/Tests/EntityDisplayTest.php1
-rw-r--r--core/modules/field_ui/src/Tests/FieldUIRouteTest.php4
-rw-r--r--core/modules/filter/src/Tests/FilterAPITest.php1
-rw-r--r--core/modules/link/src/Tests/LinkItemTest.php1
-rw-r--r--core/modules/menu_ui/menu_ui.install2
-rw-r--r--core/modules/node/node.module2
-rw-r--r--core/modules/node/src/Tests/Config/NodeImportCreateTest.php1
-rw-r--r--core/modules/node/src/Tests/NodeBodyFieldStorageTest.php1
-rw-r--r--core/modules/node/src/Tests/Views/NodeLanguageTest.php1
-rw-r--r--core/modules/options/src/Tests/OptionsFieldUnitTestBase.php1
-rw-r--r--core/modules/rdf/src/Tests/Field/FieldRdfaTestBase.php1
-rw-r--r--core/modules/search/src/Entity/SearchPage.php8
-rw-r--r--core/modules/simpletest/src/Tests/KernelTestBaseTest.php5
-rw-r--r--core/modules/system/entity.api.php2
-rw-r--r--core/modules/system/src/Controller/ThemeController.php16
-rw-r--r--core/modules/system/src/Tests/Condition/CurrentThemeConditionTest.php8
-rw-r--r--core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php1
-rw-r--r--core/modules/system/src/Tests/Module/ModuleImplementsAlterTest.php10
-rw-r--r--core/modules/system/src/Tests/Routing/RouteProviderTest.php35
-rw-r--r--core/modules/system/src/Tests/System/InfoAlterTest.php8
-rw-r--r--core/modules/system/src/Tests/Theme/RegistryTest.php10
-rw-r--r--core/modules/system/src/Tests/Theme/ThemeSettingsTest.php1
-rw-r--r--core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php2
-rw-r--r--core/modules/user/src/Tests/Views/AccessRoleTest.php4
-rw-r--r--core/modules/user/src/Tests/Views/UserUnitTestBase.php1
-rw-r--r--core/modules/views/src/Entity/View.php4
-rw-r--r--core/modules/views/src/Tests/GlossaryTest.php1
-rw-r--r--core/modules/views/src/Tests/Plugin/CacheTest.php2
-rw-r--r--core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php4
-rw-r--r--core/modules/views/src/Tests/Plugin/DisplayPageTest.php2
-rw-r--r--core/modules/views/src/Tests/Plugin/RelationshipJoinTestBase.php10
-rw-r--r--core/modules/views/src/Tests/ViewTestData.php3
-rw-r--r--core/modules/views/src/Tests/ViewUnitTestBase.php3
-rw-r--r--core/modules/views/views.module2
-rw-r--r--core/modules/views_ui/src/Tests/DisplayTest.php1
-rw-r--r--core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php10
-rw-r--r--core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php5
-rw-r--r--core/tests/Drupal/Tests/Core/Routing/NullRouteBuilder.php22
-rw-r--r--core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php35
60 files changed, 185 insertions, 293 deletions
diff --git a/core/core.services.yml b/core/core.services.yml
index d723cd8..2b81197 100644
--- a/core/core.services.yml
+++ b/core/core.services.yml
@@ -343,7 +343,7 @@ services:
arguments: ['@entity.manager', '@string_translation']
theme_handler:
class: Drupal\Core\Extension\ThemeHandler
- arguments: ['@app.root', '@config.factory', '@module_handler', '@state', '@info_parser', '@logger.channel.default', '@asset.css.collection_optimizer', '@config.installer', '@config.manager', '@router.builder_indicator']
+ arguments: ['@app.root', '@config.factory', '@module_handler', '@state', '@info_parser', '@logger.channel.default', '@asset.css.collection_optimizer', '@config.installer', '@config.manager', '@router.builder']
entity.manager:
class: Drupal\Core\Entity\EntityManager
arguments: ['@container.namespaces', '@module_handler', '@cache.discovery', '@language_manager', '@string_translation', '@class_resolver', '@typed_data_manager', '@entity.definitions.installed', '@event_dispatcher']
@@ -553,7 +553,7 @@ services:
arguments: ['@current_route_match']
router.route_provider:
class: Drupal\Core\Routing\RouteProvider
- arguments: ['@database', '@router.builder', '@state', '@path.current']
+ arguments: ['@database', '@state', '@path.current']
tags:
- { name: event_subscriber }
- { name: backend_overridable }
@@ -635,17 +635,11 @@ services:
arguments: ['@database', '@state']
tags:
- { name: backend_overridable }
- router.builder_indicator:
- class: Drupal\Core\Routing\RouteBuilderIndicator
- arguments: ['@state']
router.builder:
class: Drupal\Core\Routing\RouteBuilder
- arguments: ['@router.dumper', '@lock', '@event_dispatcher', '@module_handler', '@controller_resolver', '@access_manager.check_provider', '@router.builder_indicator']
- router.rebuild_subscriber:
- class: Drupal\Core\EventSubscriber\RouterRebuildSubscriber
- arguments: ['@router.builder']
+ arguments: ['@router.dumper', '@lock', '@event_dispatcher', '@module_handler', '@controller_resolver', '@access_manager.check_provider']
tags:
- - { name: event_subscriber }
+ - { name: needs_destruction }
menu.rebuild_subscriber:
class: Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber
arguments: ['@lock', '@plugin.manager.menu.link']
diff --git a/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php
index 57cc618..de44113 100644
--- a/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php
+++ b/core/lib/Drupal/Core/EventSubscriber/MenuRouterRebuildSubscriber.php
@@ -20,11 +20,6 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class MenuRouterRebuildSubscriber implements EventSubscriberInterface {
/**
- * @var \Drupal\Core\Routing\RouteBuilderInterface
- */
- protected $routeBuilder;
-
- /**
* @var \Drupal\Core\Lock\LockBackendInterface
*/
protected $lock;
diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php
index dba7a94..412a7b3 100644
--- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php
+++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php
@@ -220,9 +220,8 @@ class ModuleInstaller implements ModuleInstallerInterface {
// Now install the module's schema if necessary.
drupal_install_schema($module);
- // Clear plugin manager caches and flag router to rebuild if requested.
+ // Clear plugin manager caches.
\Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
// Set the schema version to the number of the last update provided by
// the module, or the minimum core schema version.
@@ -296,6 +295,7 @@ class ModuleInstaller implements ModuleInstallerInterface {
// If any modules were newly installed, invoke hook_modules_installed().
if (!empty($modules_installed)) {
+ \Drupal::service('router.builder')->rebuild();
$this->moduleHandler->invokeAll('modules_installed', array($modules_installed));
}
@@ -417,9 +417,8 @@ class ModuleInstaller implements ModuleInstallerInterface {
// its statically cached list.
drupal_static_reset('system_rebuild_module_data');
- // Clear plugin manager caches and flag router to rebuild if requested.
+ // Clear plugin manager caches.
\Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
// Update the kernel to exclude the uninstalled modules.
$this->updateKernel($module_filenames);
@@ -438,6 +437,7 @@ class ModuleInstaller implements ModuleInstallerInterface {
$schema_store = \Drupal::keyValue('system.schema');
$schema_store->delete($module);
}
+ \Drupal::service('router.builder')->rebuild();
drupal_get_installed_schema_version(NULL, TRUE);
// Let other modules react.
diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php
index 0513eb5..dcb1fe3 100644
--- a/core/lib/Drupal/Core/Extension/ThemeHandler.php
+++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php
@@ -14,7 +14,7 @@ use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\ConfigInstallerInterface;
use Drupal\Core\Config\ConfigManagerInterface;
use Drupal\Core\Config\PreExistingConfigException;
-use Drupal\Core\Routing\RouteBuilderIndicatorInterface;
+use Drupal\Core\Routing\RouteBuilderInterface;
use Drupal\Core\State\StateInterface;
use Psr\Log\LoggerInterface;
@@ -88,11 +88,11 @@ class ThemeHandler implements ThemeHandlerInterface {
protected $logger;
/**
- * The route builder indicator to rebuild the routes if a theme is installed.
+ * The route builder to rebuild the routes if a theme is installed.
*
- * @var \Drupal\Core\Routing\RouteBuilderIndicatorInterface
+ * @var \Drupal\Core\Routing\RouteBuilderInterface
*/
- protected $routeBuilderIndicator;
+ protected $routeBuilder;
/**
* An extension discovery instance.
@@ -145,13 +145,13 @@ class ThemeHandler implements ThemeHandlerInterface {
* database.
* @param \Drupal\Core\Config\ConfigManagerInterface $config_manager
* The config manager used to uninstall a theme.
- * @param \Drupal\Core\Routing\RouteBuilderIndicatorInterface $route_builder_indicator
- * (optional) The route builder indicator service to rebuild the routes if a
- * theme is installed.
+ * @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder
+ * (optional) The route builder service to rebuild the routes if a theme is
+ * installed.
* @param \Drupal\Core\Extension\ExtensionDiscovery $extension_discovery
* (optional) A extension discovery instance (for unit tests).
*/
- public function __construct($root, ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, StateInterface $state, InfoParserInterface $info_parser,LoggerInterface $logger, AssetCollectionOptimizerInterface $css_collection_optimizer = NULL, ConfigInstallerInterface $config_installer = NULL, ConfigManagerInterface $config_manager = NULL, RouteBuilderIndicatorInterface $route_builder_indicator = NULL, ExtensionDiscovery $extension_discovery = NULL) {
+ public function __construct($root, ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, StateInterface $state, InfoParserInterface $info_parser,LoggerInterface $logger, AssetCollectionOptimizerInterface $css_collection_optimizer = NULL, ConfigInstallerInterface $config_installer = NULL, ConfigManagerInterface $config_manager = NULL, RouteBuilderInterface $route_builder = NULL, ExtensionDiscovery $extension_discovery = NULL) {
$this->root = $root;
$this->configFactory = $config_factory;
$this->moduleHandler = $module_handler;
@@ -161,7 +161,7 @@ class ThemeHandler implements ThemeHandlerInterface {
$this->cssCollectionOptimizer = $css_collection_optimizer;
$this->configInstaller = $config_installer;
$this->configManager = $config_manager;
- $this->routeBuilderIndicator = $route_builder_indicator;
+ $this->routeBuilder = $route_builder;
$this->extensionDiscovery = $extension_discovery;
}
@@ -624,8 +624,8 @@ class ThemeHandler implements ThemeHandlerInterface {
* Resets some other systems like rebuilding the route information or caches.
*/
protected function resetSystem() {
- if ($this->routeBuilderIndicator) {
- $this->routeBuilderIndicator->setRebuildNeeded();
+ if ($this->routeBuilder) {
+ $this->routeBuilder->setRebuildNeeded();
}
$this->systemListReset();
diff --git a/core/lib/Drupal/Core/Menu/LocalTaskManager.php b/core/lib/Drupal/Core/Menu/LocalTaskManager.php
index 997c6db..2ef5de1 100644
--- a/core/lib/Drupal/Core/Menu/LocalTaskManager.php
+++ b/core/lib/Drupal/Core/Menu/LocalTaskManager.php
@@ -201,9 +201,6 @@ class LocalTaskManager extends DefaultPluginManager implements LocalTaskManagerI
$children = $cache->data['children'];
}
else {
- // Maybe some code asked to rebuild the routes, so rebuild the router
- // as we rely on having proper existing routes in dynamic local tasks.
- $this->routeBuilder->rebuildIfNeeded();
$definitions = $this->getDefinitions();
// We build the hierarchy by finding all tabs that should
// appear on the current route.
diff --git a/core/lib/Drupal/Core/Routing/RouteBuilder.php b/core/lib/Drupal/Core/Routing/RouteBuilder.php
index 433abec..db516af 100644
--- a/core/lib/Drupal/Core/Routing/RouteBuilder.php
+++ b/core/lib/Drupal/Core/Routing/RouteBuilder.php
@@ -12,6 +12,7 @@ use Drupal\Core\Access\CheckProviderInterface;
use Drupal\Core\Controller\ControllerResolverInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Lock\LockBackendInterface;
+use Drupal\Core\DestructableInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Routing\RouteCollection;
@@ -20,7 +21,7 @@ use Symfony\Component\Routing\Route;
/**
* Managing class for rebuilding the router table.
*/
-class RouteBuilder implements RouteBuilderInterface {
+class RouteBuilder implements RouteBuilderInterface, DestructableInterface {
/**
* The dumper to which we should send collected routes.
@@ -58,13 +59,6 @@ class RouteBuilder implements RouteBuilderInterface {
protected $moduleHandler;
/**
- * The route builder indicator.
- *
- * @var \Drupal\Core\Routing\RouteBuilderIndicatorInterface
- */
- protected $routeBuilderIndicator;
-
- /**
* The controller resolver.
*
* @var \Drupal\Core\Controller\ControllerResolverInterface
@@ -79,13 +73,20 @@ class RouteBuilder implements RouteBuilderInterface {
protected $routeCollection;
/**
- * Flag that indiciates if we are currently rebuilding the routes.
+ * Flag that indicates if we are currently rebuilding the routes.
*
* @var bool
*/
protected $building = FALSE;
/**
+ * Flag that indicates if we should rebuild at the end of the request.
+ *
+ * @var bool
+ */
+ protected $rebuildNeeded = FALSE;
+
+ /**
* The check provider.
*
* @var \Drupal\Core\Access\CheckProviderInterface
@@ -107,22 +108,26 @@ class RouteBuilder implements RouteBuilderInterface {
* The controller resolver.
* @param \Drupal\Core\Access\CheckProviderInterface $check_provider
* The check provider.
- * @param \Drupal\Core\Routing\RouteBuilderIndicatorInterface $route_build_indicator
- * The route build indicator.
*/
- public function __construct(MatcherDumperInterface $dumper, LockBackendInterface $lock, EventDispatcherInterface $dispatcher, ModuleHandlerInterface $module_handler, ControllerResolverInterface $controller_resolver, CheckProviderInterface $check_provider, RouteBuilderIndicatorInterface $route_build_indicator = NULL) {
+ public function __construct(MatcherDumperInterface $dumper, LockBackendInterface $lock, EventDispatcherInterface $dispatcher, ModuleHandlerInterface $module_handler, ControllerResolverInterface $controller_resolver, CheckProviderInterface $check_provider) {
$this->dumper = $dumper;
$this->lock = $lock;
$this->dispatcher = $dispatcher;
$this->moduleHandler = $module_handler;
$this->controllerResolver = $controller_resolver;
- $this->routeBuilderIndicator = $route_build_indicator;
$this->checkProvider = $check_provider;
}
/**
* {@inheritdoc}
*/
+ public function setRebuildNeeded() {
+ $this->rebuildNeeded = TRUE;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function rebuild() {
if ($this->building) {
throw new \RuntimeException('Recursive router rebuild detected.');
@@ -139,7 +144,6 @@ class RouteBuilder implements RouteBuilderInterface {
$this->building = TRUE;
$collection = new RouteCollection();
- $this->routeCollection = $collection;
foreach ($this->getRouteDefinitions() as $routes) {
// The top-level 'routes_callback' is a list of methods in controller
// syntax, see \Drupal\Core\Controller\ControllerResolver. These methods
@@ -176,7 +180,6 @@ class RouteBuilder implements RouteBuilderInterface {
$route = new Route($route_info['path'], $route_info['defaults'], $route_info['requirements'], $route_info['options']);
$collection->add($name, $route);
}
-
}
// DYNAMIC is supposed to be used to add new routes based upon all the
@@ -193,12 +196,11 @@ class RouteBuilder implements RouteBuilderInterface {
$this->dumper->addRoutes($collection);
$this->dumper->dump();
- $this->routeBuilderIndicator->setRebuildDone();
$this->lock->release('router_rebuild');
$this->dispatcher->dispatch(RoutingEvents::FINISHED, new Event());
$this->building = FALSE;
- $this->routeCollection = NULL;
+ $this->rebuildNeeded = FALSE;
return TRUE;
}
@@ -207,7 +209,7 @@ class RouteBuilder implements RouteBuilderInterface {
* {@inheritdoc}
*/
public function rebuildIfNeeded() {
- if ($this->routeBuilderIndicator->isRebuildNeeded()) {
+ if ($this->rebuildNeeded) {
return $this->rebuild();
}
return FALSE;
@@ -216,8 +218,11 @@ class RouteBuilder implements RouteBuilderInterface {
/**
* {@inheritdoc}
*/
- public function setRebuildNeeded() {
- $this->routeBuilderIndicator->setRebuildNeeded();
+ public function destruct() {
+ // Rebuild routes only once at the end of the request lifecycle to not
+ // trigger multiple rebuilds and also make the page more responsive for the
+ // user.
+ $this->rebuildIfNeeded();
}
/**
diff --git a/core/lib/Drupal/Core/Routing/RouteBuilderIndicator.php b/core/lib/Drupal/Core/Routing/RouteBuilderIndicator.php
deleted file mode 100644
index 5f06120..0000000
--- a/core/lib/Drupal/Core/Routing/RouteBuilderIndicator.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\Core\Routing\RouteBuilderIndicator.
- */
-
-namespace Drupal\Core\Routing;
-
-use Drupal\Core\State\StateInterface;
-use Symfony\Component\DependencyInjection\ContainerAware;
-
-/**
- * A simple service to be used instead of the route builder.
- *
- * The route builder service is required by quite a few other services,
- * however it has a lot of dependencies. Use this service to ensure that the
- * router is rebuilt.
- */
-class RouteBuilderIndicator implements RouteBuilderIndicatorInterface {
-
- /**
- * @var \Drupal\Core\State\StateInterface
- */
- protected $state;
-
- /**
- * @param \Drupal\Core\State\StateInterface $state
- */
- public function __construct(StateInterface $state) {
- $this->state = $state;
- }
-
- /**
- * {@inheritdoc}
- */
- public function setRebuildNeeded() {
- $this->state->set(static::REBUILD_NEEDED, TRUE);
- }
-
- /**
- * {@inheritdoc}
- */
- public function isRebuildNeeded() {
- return $this->state->get(static::REBUILD_NEEDED, FALSE);
- }
-
- /**
- * {@inheritdoc}
- */
- public function setRebuildDone() {
- $this->state->set(static::REBUILD_NEEDED, FALSE);
- }
-
-}
diff --git a/core/lib/Drupal/Core/Routing/RouteBuilderIndicatorInterface.php b/core/lib/Drupal/Core/Routing/RouteBuilderIndicatorInterface.php
deleted file mode 100644
index 68ce5b8..0000000
--- a/core/lib/Drupal/Core/Routing/RouteBuilderIndicatorInterface.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-
-/**
- * @file
- * Definition of Drupal\Core\Routing\RouteBuilderIndicatorInterface.
- */
-
-namespace Drupal\Core\Routing;
-
-interface RouteBuilderIndicatorInterface {
-
- /**
- * The state key to use.
- */
- const REBUILD_NEEDED = 'router_rebuild_needed';
-
- /**
- * Sets the router to be rebuilt next time the kernel is terminated.
- *
- * @see \Drupal\Core\EventSubscriber\RouterRebuildSubscriber::onKernelTerminate()
- * @see \Drupal\Core\Routing\RouteBuilderInterface::rebuildIfNeeded()
- *
- */
- public function setRebuildNeeded();
-
- /**
- * Sets the router rebuild indicator to FALSE.
- */
- public function setRebuildDone();
-
- /**
- * Checks if the router needs to be rebuilt.
- *
- * @return bool
- * TRUE if the router needs to be rebuilt, FALSE if not.
- */
- public function isRebuildNeeded();
-
-}
diff --git a/core/lib/Drupal/Core/Routing/RouteProvider.php b/core/lib/Drupal/Core/Routing/RouteProvider.php
index 58e390f..1f3e580 100644
--- a/core/lib/Drupal/Core/Routing/RouteProvider.php
+++ b/core/lib/Drupal/Core/Routing/RouteProvider.php
@@ -40,13 +40,6 @@ class RouteProvider implements RouteProviderInterface, PagedRouteProviderInterfa
protected $tableName;
/**
- * The route builder.
- *
- * @var \Drupal\Core\Routing\RouteBuilderInterface
- */
- protected $routeBuilder;
-
- /**
* The state.
*
* @var \Drupal\Core\State\StateInterface
@@ -72,8 +65,6 @@ class RouteProvider implements RouteProviderInterface, PagedRouteProviderInterfa
*
* @param \Drupal\Core\Database\Connection $connection
* A database connection object.
- * @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder
- * The route builder.
* @param \Drupal\Core\State\StateInterface $state
* The state.
* @param \Drupal\Core\Path\CurrentPathStack $current_path
@@ -81,9 +72,8 @@ class RouteProvider implements RouteProviderInterface, PagedRouteProviderInterfa
* @param string $table
* The table in the database to use for matching.
*/
- public function __construct(Connection $connection, RouteBuilderInterface $route_builder, StateInterface $state, CurrentPathStack $current_path, $table = 'router') {
+ public function __construct(Connection $connection, StateInterface $state, CurrentPathStack $current_path, $table = 'router') {
$this->connection = $connection;
- $this->routeBuilder = $route_builder;
$this->state = $state;
$this->tableName = $table;
$this->currentPath = $current_path;
@@ -117,14 +107,7 @@ class RouteProvider implements RouteProviderInterface, PagedRouteProviderInterfa
public function getRouteCollectionForRequest(Request $request) {
$path = $this->currentPath->getPath($request);
- $collection = $this->getRoutesByPath(rtrim($path, '/'));
-
- // Try rebuilding the router if it is necessary.
- if (!$collection->count() && $this->routeBuilder->rebuildIfNeeded()) {
- $collection = $this->getRoutesByPath($path);
- }
-
- return $collection;
+ return $this->getRoutesByPath(rtrim($path, '/'));
}
/**
@@ -170,8 +153,6 @@ class RouteProvider implements RouteProviderInterface, PagedRouteProviderInterfa
throw new \InvalidArgumentException('You must specify the route names to load');
}
- $this->routeBuilder->rebuildIfNeeded();
-
$routes_to_load = array_diff($names, array_keys($this->routes));
if ($routes_to_load) {
$result = $this->connection->query('SELECT name, route FROM {' . $this->connection->escapeTable($this->tableName) . '} WHERE name IN ( :names[] )', array(':names[]' => $routes_to_load));
@@ -257,7 +238,6 @@ class RouteProvider implements RouteProviderInterface, PagedRouteProviderInterfa
*/
public function getRoutesByPattern($pattern) {
$path = RouteCompiler::getPatternOutline($pattern);
- $this->routeBuilder->rebuildIfNeeded();
return $this->getRoutesByPath($path);
}
diff --git a/core/modules/book/src/Tests/BookUninstallTest.php b/core/modules/book/src/Tests/BookUninstallTest.php
index 317a16a..dbd4de5 100644
--- a/core/modules/book/src/Tests/BookUninstallTest.php
+++ b/core/modules/book/src/Tests/BookUninstallTest.php
@@ -30,6 +30,7 @@ class BookUninstallTest extends KernelTestBase {
*/
protected function setUp() {
parent::setUp();
+ $this->installSchema('system', array('router'));
$this->installEntitySchema('user');
$this->installEntitySchema('node');
$this->installSchema('book', array('book'));
diff --git a/core/modules/breakpoint/src/Tests/BreakpointDiscoveryTest.php b/core/modules/breakpoint/src/Tests/BreakpointDiscoveryTest.php
index 83986eb..e21723a 100644
--- a/core/modules/breakpoint/src/Tests/BreakpointDiscoveryTest.php
+++ b/core/modules/breakpoint/src/Tests/BreakpointDiscoveryTest.php
@@ -20,10 +20,11 @@ class BreakpointDiscoveryTest extends KernelTestBase {
*
* @var array
*/
- public static $modules = array('breakpoint', 'breakpoint_module_test');
+ public static $modules = array('system', 'breakpoint', 'breakpoint_module_test');
protected function setUp() {
parent::setUp();
+ $this->installSchema('system', array('router'));
\Drupal::service('theme_handler')->install(array('breakpoint_theme_test'));
}
diff --git a/core/modules/ckeditor/src/Tests/CKEditorTest.php b/core/modules/ckeditor/src/Tests/CKEditorTest.php
index 25558d3..ab303b6 100644
--- a/core/modules/ckeditor/src/Tests/CKEditorTest.php
+++ b/core/modules/ckeditor/src/Tests/CKEditorTest.php
@@ -44,6 +44,7 @@ class CKEditorTest extends KernelTestBase {
// Install the Filter module.
$this->installSchema('system', 'url_alias');
+ $this->installSchema('system', 'router');
// Create text format, associate CKEditor.
$filtered_html_format = entity_create('filter_format', array(
diff --git a/core/modules/comment/src/Tests/CommentStringIdEntitiesTest.php b/core/modules/comment/src/Tests/CommentStringIdEntitiesTest.php
index 3cb8ab0..ddfaf8f 100644
--- a/core/modules/comment/src/Tests/CommentStringIdEntitiesTest.php
+++ b/core/modules/comment/src/Tests/CommentStringIdEntitiesTest.php
@@ -29,6 +29,7 @@ class CommentStringIdEntitiesTest extends KernelTestBase {
'field_ui',
'entity',
'entity_test',
+ 'system',
'text',
);
@@ -36,6 +37,7 @@ class CommentStringIdEntitiesTest extends KernelTestBase {
parent::setUp();
$this->installEntitySchema('comment');
$this->installSchema('comment', array('comment_entity_statistics'));
+ $this->installSchema('system', array('router'));
// Create the comment body field storage.
$this->installConfig(array('field'));
}
diff --git a/core/modules/config/src/Tests/ConfigCRUDTest.php b/core/modules/config/src/Tests/ConfigCRUDTest.php
index f42d722..c530b96 100644
--- a/core/modules/config/src/Tests/ConfigCRUDTest.php
+++ b/core/modules/config/src/Tests/ConfigCRUDTest.php
@@ -39,6 +39,11 @@ class ConfigCRUDTest extends KernelTestBase {
*/
public static $modules = array('system');
+ protected function setUp() {
+ parent::setUp();
+ $this->installSchema('system', 'router');
+ }
+
/**
* Tests CRUD operations.
*/
diff --git a/core/modules/config/src/Tests/DefaultConfigTest.php b/core/modules/config/src/Tests/DefaultConfigTest.php
index 99ff07a..2d5412c 100644
--- a/core/modules/config/src/Tests/DefaultConfigTest.php
+++ b/core/modules/config/src/Tests/DefaultConfigTest.php
@@ -45,6 +45,7 @@ class DefaultConfigTest extends KernelTestBase {
protected function setUp() {
parent::setUp();
+ $this->installSchema('system', 'router');
\Drupal::service('theme_handler')->install($this->themes);
}
diff --git a/core/modules/content_translation/content_translation.admin.inc b/core/modules/content_translation/content_translation.admin.inc
index fbb3a78..2c55fa9 100644
--- a/core/modules/content_translation/content_translation.admin.inc
+++ b/core/modules/content_translation/content_translation.admin.inc
@@ -295,7 +295,7 @@ function content_translation_form_language_content_settings_submit(array $form,
// Ensure entity and menu router information are correctly rebuilt.
\Drupal::entityManager()->clearCachedDefinitions();
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
+ \Drupal::service('router.builder')->setRebuildNeeded();
// If an entity type is not translatable all its bundles and fields must be
// marked as non-translatable. Similarly, if a bundle is made non-translatable
diff --git a/core/modules/content_translation/content_translation.module b/core/modules/content_translation/content_translation.module
index 8f5e8fd..93d73f9 100644
--- a/core/modules/content_translation/content_translation.module
+++ b/core/modules/content_translation/content_translation.module
@@ -477,7 +477,7 @@ function content_translation_language_configuration_element_submit(array $form,
if (\Drupal::service('content_translation.manager')->isEnabled($context['entity_type'], $context['bundle']) != $enabled) {
\Drupal::service('content_translation.manager')->setEnabled($context['entity_type'], $context['bundle'], $enabled);
\Drupal::entityManager()->clearCachedDefinitions();
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
+ \Drupal::service('router.builder')->setRebuildNeeded();
}
}
diff --git a/core/modules/field/src/Tests/FieldAttachOtherTest.php b/core/modules/field/src/Tests/FieldAttachOtherTest.php
index f3b0f67..af92af7 100644
--- a/core/modules/field/src/Tests/FieldAttachOtherTest.php
+++ b/core/modules/field/src/Tests/FieldAttachOtherTest.php
@@ -20,7 +20,6 @@ class FieldAttachOtherTest extends FieldUnitTestBase {
protected function setUp() {
parent::setUp();
- $this->installSchema('system', array('router'));
$this->container->get('router.builder')->rebuild();
$this->installEntitySchema('entity_test_rev');
$this->createFieldWithStorage();
diff --git a/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php b/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php
index 3e83c4d..d71be2e 100644
--- a/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php
+++ b/core/modules/field/src/Tests/FieldImportDeleteUninstallTest.php
@@ -29,7 +29,6 @@ class FieldImportDeleteUninstallTest extends FieldUnitTestBase {
// Module uninstall requires the router and users_data tables.
// @see drupal_flush_all_caches()
// @see user_modules_uninstalled()
- $this->installSchema('system', array('router'));
$this->installSchema('user', array('users_data'));
}
diff --git a/core/modules/field/src/Tests/FieldUnitTestBase.php b/core/modules/field/src/Tests/FieldUnitTestBase.php
index 0b0895f..3c2b535 100644
--- a/core/modules/field/src/Tests/FieldUnitTestBase.php
+++ b/core/modules/field/src/Tests/FieldUnitTestBase.php
@@ -51,6 +51,7 @@ abstract class FieldUnitTestBase extends KernelTestBase {
$this->installEntitySchema('entity_test');
$this->installEntitySchema('user');
$this->installSchema('system', array('sequences'));
+ $this->installSchema('system', array('router'));
// Set default storage backend and configure the theme system.
$this->installConfig(array('field', 'system'));
diff --git a/core/modules/field_ui/field_ui.module b/core/modules/field_ui/field_ui.module
index 64b62ef..5c2e22f 100644
--- a/core/modules/field_ui/field_ui.module
+++ b/core/modules/field_ui/field_ui.module
@@ -80,7 +80,7 @@ function field_ui_entity_type_build(array &$entity_types) {
function field_ui_entity_bundle_create($entity_type, $bundle) {
// When a new bundle is created, the menu needs to be rebuilt to add our
// menu item tabs.
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
+ \Drupal::service('router.builder')->setRebuildNeeded();
}
/**
@@ -89,7 +89,7 @@ function field_ui_entity_bundle_create($entity_type, $bundle) {
function field_ui_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) {
// When a bundle is renamed, the menu needs to be rebuilt to add our
// menu item tabs.
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
+ \Drupal::service('router.builder')->setRebuildNeeded();
}
/**
@@ -169,28 +169,28 @@ function field_ui_form_node_type_form_submit($form, FormStateInterface $form_sta
* Implements hook_entity_view_mode_presave().
*/
function field_ui_entity_view_mode_presave(EntityViewModeInterface $view_mode) {
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
+ \Drupal::service('router.builder')->setRebuildNeeded();
}
/**
* Implements hook_entity_form_mode_presave().
*/
function field_ui_entity_form_mode_presave(EntityFormModeInterface $form_mode) {
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
+ \Drupal::service('router.builder')->setRebuildNeeded();
}
/**
* Implements hook_entity_view_mode_delete().
*/
function field_ui_entity_view_mode_delete(EntityViewModeInterface $view_mode) {
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
+ \Drupal::service('router.builder')->setRebuildNeeded();
}
/**
* Implements hook_entity_form_mode_delete().
*/
function field_ui_entity_form_mode_delete(EntityFormModeInterface $form_mode) {
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
+ \Drupal::service('router.builder')->setRebuildNeeded();
}
/**
diff --git a/core/modules/field_ui/src/Tests/EntityDisplayTest.php b/core/modules/field_ui/src/Tests/EntityDisplayTest.php
index ef0f476..9cedc2d 100644
--- a/core/modules/field_ui/src/Tests/EntityDisplayTest.php
+++ b/core/modules/field_ui/src/Tests/EntityDisplayTest.php
@@ -26,6 +26,7 @@ class EntityDisplayTest extends KernelTestBase {
protected function setUp() {
parent::setUp();
+ $this->installSchema('system', array('router'));
$this->installEntitySchema('node');
$this->installConfig(array('field'));
}
diff --git a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php
index 6ca3df9..5fd8ec0 100644
--- a/core/modules/field_ui/src/Tests/FieldUIRouteTest.php
+++ b/core/modules/field_ui/src/Tests/FieldUIRouteTest.php
@@ -80,6 +80,8 @@ class FieldUIRouteTest extends WebTestBase {
'label' => 'Test',
'targetEntityType' => 'user',
))->save();
+ $this->container->get('router.builder')->rebuildIfNeeded();
+
$edit = array('display_modes_custom[test]' => TRUE);
$this->drupalPostForm('admin/config/people/accounts/display', $edit, t('Save'));
$this->assertLink('Test');
@@ -91,6 +93,8 @@ class FieldUIRouteTest extends WebTestBase {
'label' => 'Test',
'targetEntityType' => 'user',
))->save();
+ $this->container->get('router.builder')->rebuildIfNeeded();
+
$edit = array('display_modes_custom[test]' => TRUE);
$this->drupalPostForm('admin/config/people/accounts/form-display', $edit, t('Save'));
$this->assertLink('Test');
diff --git a/core/modules/filter/src/Tests/FilterAPITest.php b/core/modules/filter/src/Tests/FilterAPITest.php
index 6ee11e2..3ceb5eb 100644
--- a/core/modules/filter/src/Tests/FilterAPITest.php
+++ b/core/modules/filter/src/Tests/FilterAPITest.php
@@ -28,6 +28,7 @@ class FilterAPITest extends EntityUnitTestBase {
protected function setUp() {
parent::setUp();
+ $this->installSchema('system', array('router'));
$this->installConfig(array('system', 'filter'));
}
diff --git a/core/modules/link/src/Tests/LinkItemTest.php b/core/modules/link/src/Tests/LinkItemTest.php
index 017c83e..b39d4be 100644
--- a/core/modules/link/src/Tests/LinkItemTest.php
+++ b/core/modules/link/src/Tests/LinkItemTest.php
@@ -28,7 +28,6 @@ class LinkItemTest extends FieldUnitTestBase {
protected function setUp() {
parent::setUp();
- $this->installSchema('system', ['router']);
// Create a link field for validation.
entity_create('field_storage_config', array(
diff --git a/core/modules/menu_ui/menu_ui.install b/core/modules/menu_ui/menu_ui.install
index c2aadce..a75a02c 100644
--- a/core/modules/menu_ui/menu_ui.install
+++ b/core/modules/menu_ui/menu_ui.install
@@ -21,5 +21,5 @@ function menu_ui_install() {
* Implements hook_uninstall().
*/
function menu_ui_uninstall() {
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
+ \Drupal::service('router.builder')->setRebuildNeeded();
}
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index 611ae17..f181df1 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -880,7 +880,7 @@ function node_form_system_themes_admin_form_submit($form, FormStateInterface $fo
\Drupal::configFactory()->getEditable('node.settings')
->set('use_admin_theme', $form_state->getValue('use_admin_theme'))
->save();
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
+ \Drupal::service('router.builder')->setRebuildNeeded();
}
/**
diff --git a/core/modules/node/src/Tests/Config/NodeImportCreateTest.php b/core/modules/node/src/Tests/Config/NodeImportCreateTest.php
index 97fe51f..f6902e39 100644
--- a/core/modules/node/src/Tests/Config/NodeImportCreateTest.php
+++ b/core/modules/node/src/Tests/Config/NodeImportCreateTest.php
@@ -30,6 +30,7 @@ class NodeImportCreateTest extends KernelTestBase {
*/
protected function setUp() {
parent::setUp();
+ $this->installSchema('system', array('router'));
$this->installEntitySchema('user');
// Set default storage backend.
diff --git a/core/modules/node/src/Tests/NodeBodyFieldStorageTest.php b/core/modules/node/src/Tests/NodeBodyFieldStorageTest.php
index bdfa24c..6e606f5 100644
--- a/core/modules/node/src/Tests/NodeBodyFieldStorageTest.php
+++ b/core/modules/node/src/Tests/NodeBodyFieldStorageTest.php
@@ -32,6 +32,7 @@ class NodeBodyFieldStorageTest extends KernelTestBase {
protected function setUp() {
parent::setUp();
$this->installSchema('system', 'sequences');
+ $this->installSchema('system', array('router'));
// Necessary for module uninstall.
$this->installSchema('user', 'users_data');
$this->installEntitySchema('user');
diff --git a/core/modules/node/src/Tests/Views/NodeLanguageTest.php b/core/modules/node/src/Tests/Views/NodeLanguageTest.php
index d2101ab..64e4d4d 100644
--- a/core/modules/node/src/Tests/Views/NodeLanguageTest.php
+++ b/core/modules/node/src/Tests/Views/NodeLanguageTest.php
@@ -90,6 +90,7 @@ class NodeLanguageTest extends NodeTestBase {
}
$node->save();
}
+ $this->container->get('router.builder')->rebuild();
$user = $this->drupalCreateUser(array('access content overview', 'access content'));
$this->drupalLogin($user);
diff --git a/core/modules/options/src/Tests/OptionsFieldUnitTestBase.php b/core/modules/options/src/Tests/OptionsFieldUnitTestBase.php
index a254a0a..fcfe4f8 100644
--- a/core/modules/options/src/Tests/OptionsFieldUnitTestBase.php
+++ b/core/modules/options/src/Tests/OptionsFieldUnitTestBase.php
@@ -55,7 +55,6 @@ abstract class OptionsFieldUnitTestBase extends FieldUnitTestBase {
*/
protected function setUp() {
parent::setUp();
- $this->installSchema('system', array('router'));
$this->container->get('router.builder')->rebuild();
$this->fieldStorageDefinition = array(
diff --git a/core/modules/rdf/src/Tests/Field/FieldRdfaTestBase.php b/core/modules/rdf/src/Tests/Field/FieldRdfaTestBase.php
index adddda1..6161326 100644
--- a/core/modules/rdf/src/Tests/Field/FieldRdfaTestBase.php
+++ b/core/modules/rdf/src/Tests/Field/FieldRdfaTestBase.php
@@ -63,7 +63,6 @@ abstract class FieldRdfaTestBase extends FieldUnitTestBase {
protected function setUp() {
parent::setUp();
- $this->installSchema('system', array('router'));
\Drupal::service('router.builder')->rebuild();
}
diff --git a/core/modules/search/src/Entity/SearchPage.php b/core/modules/search/src/Entity/SearchPage.php
index d8cfc41..0f583c7 100644
--- a/core/modules/search/src/Entity/SearchPage.php
+++ b/core/modules/search/src/Entity/SearchPage.php
@@ -184,7 +184,7 @@ class SearchPage extends ConfigEntityBase implements SearchPageInterface, Entity
*/
public function postSave(EntityStorageInterface $storage, $update = TRUE) {
parent::postSave($storage, $update);
- $this->routeBuilderIndicator()->setRebuildNeeded();
+ $this->routeBuilder()->setRebuildNeeded();
}
/**
@@ -216,11 +216,11 @@ class SearchPage extends ConfigEntityBase implements SearchPageInterface, Entity
/**
* Wraps the route builder.
*
- * @return \Drupal\Core\Routing\RouteBuilderIndicatorInterface
+ * @return \Drupal\Core\Routing\RouteBuilderInterface
* An object for state storage.
*/
- protected function routeBuilderIndicator() {
- return \Drupal::service('router.builder_indicator');
+ protected function routeBuilder() {
+ return \Drupal::service('router.builder');
}
/**
diff --git a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php
index 218d0b9..8d2382e 100644
--- a/core/modules/simpletest/src/Tests/KernelTestBaseTest.php
+++ b/core/modules/simpletest/src/Tests/KernelTestBaseTest.php
@@ -21,7 +21,7 @@ class KernelTestBaseTest extends KernelTestBase {
*
* @var array
*/
- public static $modules = array('entity_test');
+ public static $modules = array('entity_test', 'system');
/**
* {@inheritdoc}
@@ -44,6 +44,7 @@ EOS;
$original_container = $this->originalContainer;
parent::setUp();
+ $this->installSchema('system', array('router'));
$this->assertNotIdentical(\Drupal::getContainer(), $original_container, 'KernelTestBase test creates a new container.');
}
@@ -51,7 +52,7 @@ EOS;
* Tests expected behavior of setUp().
*/
function testSetUp() {
- $modules = array('entity_test');
+ $modules = array('entity_test', 'system');
$table = 'entity_test';
// Verify that specified $modules have been loaded.
diff --git a/core/modules/system/entity.api.php b/core/modules/system/entity.api.php
index dd096ca..5ebaca6 100644
--- a/core/modules/system/entity.api.php
+++ b/core/modules/system/entity.api.php
@@ -722,7 +722,7 @@ function hook_entity_bundle_info_alter(&$bundles) {
function hook_entity_bundle_create($entity_type_id, $bundle) {
// When a new bundle is created, the menu needs to be rebuilt to add the
// Field UI menu item tabs.
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
+ \Drupal::service('router.builder')->setRebuildNeeded();
}
/**
diff --git a/core/modules/system/src/Controller/ThemeController.php b/core/modules/system/src/Controller/ThemeController.php
index f1d1b9e..dd5f749 100644
--- a/core/modules/system/src/Controller/ThemeController.php
+++ b/core/modules/system/src/Controller/ThemeController.php
@@ -11,7 +11,7 @@ use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\PreExistingConfigException;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Extension\ThemeHandlerInterface;
-use Drupal\Core\Routing\RouteBuilderIndicatorInterface;
+use Drupal\Core\Routing\RouteBuilderInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
@@ -31,24 +31,24 @@ class ThemeController extends ControllerBase {
/**
* The route builder service.
*
- * @var \Drupal\Core\Routing\RouteBuilderIndicatorInterface
+ * @var \Drupal\Core\Routing\RouteBuilderInterface
*/
- protected $routeBuilderIndicator;
+ protected $routeBuilder;
/**
* Constructs a new ThemeController.
*
* @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
* The theme handler.
- * @param \Drupal\Core\Routing\RouteBuilderIndicatorInterface $route_builder_indicator
+ * @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder
* The route builder.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
- public function __construct(ThemeHandlerInterface $theme_handler, RouteBuilderIndicatorInterface $route_builder_indicator, ConfigFactoryInterface $config_factory) {
+ public function __construct(ThemeHandlerInterface $theme_handler, RouteBuilderInterface $route_builder, ConfigFactoryInterface $config_factory) {
$this->themeHandler = $theme_handler;
- $this->routeBuilderIndicator = $route_builder_indicator;
$this->configFactory = $config_factory;
+ $this->routeBuilder = $route_builder;
}
/**
@@ -57,7 +57,7 @@ class ThemeController extends ControllerBase {
public static function create(ContainerInterface $container) {
return new static(
$container->get('theme_handler'),
- $container->get('router.builder_indicator'),
+ $container->get('router.builder'),
$container->get('config.factory')
);
}
@@ -179,7 +179,7 @@ class ThemeController extends ControllerBase {
// Set the default theme.
$config->set('default', $theme)->save();
- $this->routeBuilderIndicator->setRebuildNeeded();
+ $this->routeBuilder->setRebuildNeeded();
// The status message depends on whether an admin theme is currently in
// use: a value of 0 means the admin theme is set to be the default
diff --git a/core/modules/system/src/Tests/Condition/CurrentThemeConditionTest.php b/core/modules/system/src/Tests/Condition/CurrentThemeConditionTest.php
index 60b7281..164b1e9 100644
--- a/core/modules/system/src/Tests/Condition/CurrentThemeConditionTest.php
+++ b/core/modules/system/src/Tests/Condition/CurrentThemeConditionTest.php
@@ -23,6 +23,14 @@ class CurrentThemeConditionTest extends KernelTestBase {
public static $modules = array('system', 'theme_test');
/**
+ * {@inheritdoc}
+ */
+ protected function setUp() {
+ parent::setUp();
+ $this->installSchema('system', array('router'));
+ }
+
+ /**
* Tests the current theme condition.
*/
public function testCurrentTheme() {
diff --git a/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php b/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php
index f427ade..ea46747 100644
--- a/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php
+++ b/core/modules/system/src/Tests/Field/FieldModuleUninstallValidatorTest.php
@@ -31,6 +31,7 @@ class FieldModuleUninstallValidatorTest extends EntityUnitTestBase {
*/
protected function setUp() {
parent::setUp();
+ $this->installSchema('system', 'router');
$this->installSchema('user', 'users_data');
$this->entityDefinitionUpdateManager = $this->container->get('entity.definition_update_manager');
diff --git a/core/modules/system/src/Tests/Module/ModuleImplementsAlterTest.php b/core/modules/system/src/Tests/Module/ModuleImplementsAlterTest.php
index 2a34c20..b831830 100644
--- a/core/modules/system/src/Tests/Module/ModuleImplementsAlterTest.php
+++ b/core/modules/system/src/Tests/Module/ModuleImplementsAlterTest.php
@@ -16,6 +16,16 @@ use Drupal\simpletest\KernelTestBase;
*/
class ModuleImplementsAlterTest extends KernelTestBase {
+ public static $modules = array('system');
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function setUp() {
+ parent::setUp();
+ $this->installSchema('system', array('router'));
+ }
+
/**
* Tests hook_module_implements_alter() adding an implementation.
*
diff --git a/core/modules/system/src/Tests/Routing/RouteProviderTest.php b/core/modules/system/src/Tests/Routing/RouteProviderTest.php
index f8e4c5a..c9af886 100644
--- a/core/modules/system/src/Tests/Routing/RouteProviderTest.php
+++ b/core/modules/system/src/Tests/Routing/RouteProviderTest.php
@@ -21,7 +21,6 @@ use Drupal\Core\Routing\RouteProvider;
use Drupal\Core\Database\Database;
use Drupal\Core\Routing\MatcherDumper;
use Drupal\Tests\Core\Routing\RoutingFixtures;
-use Drupal\Tests\Core\Routing\NullRouteBuilder;
/**
* Confirm that the default route provider is working correctly.
@@ -38,13 +37,6 @@ class RouteProviderTest extends KernelTestBase {
protected $fixtures;
/**
- * A null route builder to enable testing of the route provider.
- *
- * @var \Drupal\Core\Routing\RouteBuilderInterface
- */
- protected $routeBuilder;
-
- /**
* The state.
*
* @var \Drupal\Core\State\StateInterface
@@ -61,7 +53,6 @@ class RouteProviderTest extends KernelTestBase {
protected function setUp() {
parent::setUp();
$this->fixtures = new RoutingFixtures();
- $this->routeBuilder = new NullRouteBuilder();
$this->state = new State(new KeyValueMemoryFactory());
$this->currentPath = new CurrentPathStack(new RequestStack());
}
@@ -78,7 +69,7 @@ class RouteProviderTest extends KernelTestBase {
public function testCandidateOutlines() {
$connection = Database::getConnection();
- $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, $this->currentPath, 'test_routes');
+ $provider = new RouteProvider($connection, $this->state, $this->currentPath, 'test_routes');
$parts = array('node', '5', 'edit');
@@ -101,7 +92,7 @@ class RouteProviderTest extends KernelTestBase {
*/
function testExactPathMatch() {
$connection = Database::getConnection();
- $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, $this->currentPath, 'test_routes');
+ $provider = new RouteProvider($connection, $this->state, $this->currentPath, 'test_routes');
$this->fixtures->createTables($connection);
@@ -125,7 +116,7 @@ class RouteProviderTest extends KernelTestBase {
*/
function testOutlinePathMatch() {
$connection = Database::getConnection();
- $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, $this->currentPath, 'test_routes');
+ $provider = new RouteProvider($connection, $this->state, $this->currentPath, 'test_routes');
$this->fixtures->createTables($connection);
@@ -154,7 +145,7 @@ class RouteProviderTest extends KernelTestBase {
*/
function testOutlinePathMatchTrailingSlash() {
$connection = Database::getConnection();
- $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, $this->currentPath, 'test_routes');
+ $provider = new RouteProvider($connection, $this->state, $this->currentPath, 'test_routes');
$this->fixtures->createTables($connection);
@@ -183,7 +174,7 @@ class RouteProviderTest extends KernelTestBase {
*/
function testOutlinePathMatchDefaults() {
$connection = Database::getConnection();
- $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, $this->currentPath, 'test_routes');
+ $provider = new RouteProvider($connection, $this->state, $this->currentPath, 'test_routes');
$this->fixtures->createTables($connection);
@@ -221,7 +212,7 @@ class RouteProviderTest extends KernelTestBase {
*/
function testOutlinePathMatchDefaultsCollision() {
$connection = Database::getConnection();
- $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, $this->currentPath, 'test_routes');
+ $provider = new RouteProvider($connection, $this->state, $this->currentPath, 'test_routes');
$this->fixtures->createTables($connection);
@@ -260,7 +251,7 @@ class RouteProviderTest extends KernelTestBase {
*/
function testOutlinePathMatchDefaultsCollision2() {
$connection = Database::getConnection();
- $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, $this->currentPath, 'test_routes');
+ $provider = new RouteProvider($connection, $this->state, $this->currentPath, 'test_routes');
$this->fixtures->createTables($connection);
@@ -299,7 +290,7 @@ class RouteProviderTest extends KernelTestBase {
*/
public function testOutlinePathMatchZero() {
$connection = Database::getConnection();
- $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, $this->currentPath, 'test_routes');
+ $provider = new RouteProvider($connection, $this->state, $this->currentPath, 'test_routes');
$this->fixtures->createTables($connection);
@@ -334,7 +325,7 @@ class RouteProviderTest extends KernelTestBase {
*/
function testOutlinePathNoMatch() {
$connection = Database::getConnection();
- $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, $this->currentPath, 'test_routes');
+ $provider = new RouteProvider($connection, $this->state, $this->currentPath, 'test_routes');
$this->fixtures->createTables($connection);
@@ -359,7 +350,7 @@ class RouteProviderTest extends KernelTestBase {
*/
function testCurrentPath() {
$connection = Database::getConnection();
- $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, $this->currentPath, 'test_routes');
+ $provider = new RouteProvider($connection, $this->state, $this->currentPath, 'test_routes');
$this->fixtures->createTables($connection);
@@ -384,7 +375,7 @@ class RouteProviderTest extends KernelTestBase {
*/
public function testRouteByName() {
$connection = Database::getConnection();
- $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, $this->currentPath, 'test_routes');
+ $provider = new RouteProvider($connection, $this->state, $this->currentPath, 'test_routes');
$this->fixtures->createTables($connection);
@@ -419,7 +410,7 @@ class RouteProviderTest extends KernelTestBase {
*/
public function testGetRoutesByPatternWithLongPatterns() {
$connection = Database::getConnection();
- $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, $this->currentPath, 'test_routes');
+ $provider = new RouteProvider($connection, $this->state, $this->currentPath, 'test_routes');
$this->fixtures->createTables($connection);
// This pattern has only 3 parts, so we will get candidates, but no routes,
@@ -477,7 +468,7 @@ class RouteProviderTest extends KernelTestBase {
*/
public function testGetRoutesPaged() {
$connection = Database::getConnection();
- $provider = new RouteProvider($connection, $this->routeBuilder, $this->state, $this->currentPath, 'test_routes');
+ $provider = new RouteProvider($connection, $this->state, $this->currentPath, 'test_routes');
$this->fixtures->createTables($connection);
$dumper = new MatcherDumper($connection, $this->state, 'test_routes');
diff --git a/core/modules/system/src/Tests/System/InfoAlterTest.php b/core/modules/system/src/Tests/System/InfoAlterTest.php
index 02cdd17..42f5041 100644
--- a/core/modules/system/src/Tests/System/InfoAlterTest.php
+++ b/core/modules/system/src/Tests/System/InfoAlterTest.php
@@ -19,6 +19,14 @@ class InfoAlterTest extends KernelTestBase {
public static $modules = array('system');
/**
+ * {@inheritdoc}
+ */
+ protected function setUp() {
+ parent::setUp();
+ $this->installSchema('system', array('router'));
+ }
+
+ /**
* Tests that theme .info.yml data is rebuild after enabling a module.
*
* Tests that info data is rebuilt after a module that implements
diff --git a/core/modules/system/src/Tests/Theme/RegistryTest.php b/core/modules/system/src/Tests/Theme/RegistryTest.php
index 22f0cde..763372e 100644
--- a/core/modules/system/src/Tests/Theme/RegistryTest.php
+++ b/core/modules/system/src/Tests/Theme/RegistryTest.php
@@ -26,6 +26,16 @@ class RegistryTest extends KernelTestBase {
public static $modules = array('theme_test', 'system');
protected $profile = 'testing';
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function setUp() {
+ parent::setUp();
+
+ $this->installSchema('system', ['router']);
+ }
+
/**
* Tests the behavior of the theme registry class.
*/
diff --git a/core/modules/system/src/Tests/Theme/ThemeSettingsTest.php b/core/modules/system/src/Tests/Theme/ThemeSettingsTest.php
index 3ef48d0..09d73e7 100644
--- a/core/modules/system/src/Tests/Theme/ThemeSettingsTest.php
+++ b/core/modules/system/src/Tests/Theme/ThemeSettingsTest.php
@@ -34,6 +34,7 @@ class ThemeSettingsTest extends KernelTestBase {
protected function setUp() {
parent::setUp();
+ $this->installSchema('system', array('router'));
// Theme settings rely on System module's system.theme.global configuration.
$this->installConfig(array('system'));
diff --git a/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php b/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php
index cfc76bd..d58b2d5 100644
--- a/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php
+++ b/core/modules/taxonomy/src/Tests/Views/TaxonomyFieldFilterTest.php
@@ -93,7 +93,7 @@ class TaxonomyFieldFilterTest extends ViewTestBase {
Views::viewsData()->clear();
ViewTestData::createTestViews(get_class($this), array('taxonomy_test_views'));
-
+ $this->container->get('router.builder')->rebuild();
}
/**
diff --git a/core/modules/user/src/Tests/Views/AccessRoleTest.php b/core/modules/user/src/Tests/Views/AccessRoleTest.php
index bd55022..f79e86e 100644
--- a/core/modules/user/src/Tests/Views/AccessRoleTest.php
+++ b/core/modules/user/src/Tests/Views/AccessRoleTest.php
@@ -30,13 +30,14 @@ class AccessRoleTest extends AccessTestBase {
* Tests role access plugin.
*/
function testAccessRole() {
- /** @var \Drupal\views\ViewentityInterface $view */
+ /** @var \Drupal\views\ViewEntityInterface $view */
$view = \Drupal::entityManager()->getStorage('view')->load('test_access_role');
$display = &$view->getDisplay('default');
$display['display_options']['access']['options']['role'] = array(
$this->normalRole => $this->normalRole,
);
$view->save();
+ $this->container->get('router.builder')->rebuildIfNeeded();
$expected = [
'config' => ['user.role.' . $this->normalRole],
'module' => ['user'],
@@ -69,6 +70,7 @@ class AccessRoleTest extends AccessTestBase {
'anonymous' => 'anonymous',
);
$view->save();
+ $this->container->get('router.builder')->rebuildIfNeeded();
// Ensure that the list of roles is sorted correctly, if the generated role
// ID comes before 'anonymous', see https://www.drupal.org/node/2398259.
diff --git a/core/modules/user/src/Tests/Views/UserUnitTestBase.php b/core/modules/user/src/Tests/Views/UserUnitTestBase.php
index 672bae7..433719f 100644
--- a/core/modules/user/src/Tests/Views/UserUnitTestBase.php
+++ b/core/modules/user/src/Tests/Views/UserUnitTestBase.php
@@ -49,7 +49,6 @@ abstract class UserUnitTestBase extends ViewUnitTestBase {
ViewTestData::createTestViews(get_class($this), array('user_test_views'));
$this->installEntitySchema('user');
- $this->installSchema('system', 'sequences');
$entity_manager = $this->container->get('entity.manager');
$this->roleStorage = $entity_manager->getStorage('user_role');
diff --git a/core/modules/views/src/Entity/View.php b/core/modules/views/src/Entity/View.php
index daca68f..51ad1a6 100644
--- a/core/modules/views/src/Entity/View.php
+++ b/core/modules/views/src/Entity/View.php
@@ -333,9 +333,9 @@ class View extends ConfigEntityBase implements ViewEntityInterface {
// @todo Remove if views implements a view_builder controller.
views_invalidate_cache();
- // Rebuild the router case the view got enabled.
+ // Rebuild the router if this is a new view, or it's status changed.
if (!isset($this->original) || ($this->status() != $this->original->status())) {
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
+ \Drupal::service('router.builder')->setRebuildNeeded();
}
}
diff --git a/core/modules/views/src/Tests/GlossaryTest.php b/core/modules/views/src/Tests/GlossaryTest.php
index 2b0534a..fd97978 100644
--- a/core/modules/views/src/Tests/GlossaryTest.php
+++ b/core/modules/views/src/Tests/GlossaryTest.php
@@ -68,6 +68,7 @@ class GlossaryTest extends ViewTestBase {
// Enable the glossary to be displayed.
$view->storage->enable()->save();
+ $this->container->get('router.builder')->rebuildIfNeeded();
// Check the actual page response.
$this->drupalGet('glossary');
$this->assertResponse(200);
diff --git a/core/modules/views/src/Tests/Plugin/CacheTest.php b/core/modules/views/src/Tests/Plugin/CacheTest.php
index d730abf..9e2c6c4 100644
--- a/core/modules/views/src/Tests/Plugin/CacheTest.php
+++ b/core/modules/views/src/Tests/Plugin/CacheTest.php
@@ -253,6 +253,8 @@ class CacheTest extends PluginTestBase {
)
));
$view->save();
+ $this->container->get('router.builder')->rebuildIfNeeded();
+
$output_key = $view->getDisplay()->getPlugin('cache')->generateOutputKey();
$this->assertFalse(\Drupal::cache('render')->get($output_key));
diff --git a/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php b/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php
index 4cfce8c..e9052b4 100644
--- a/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php
+++ b/core/modules/views/src/Tests/Plugin/DisabledDisplayTest.php
@@ -73,6 +73,8 @@ class DisabledDisplayTest extends PluginTestBase {
$this->assertTrue($enabled, 'Display ' . $display_id . ' is now enabled');
}
+ \Drupal::service('router.builder')->rebuildIfNeeded();
+
// Check that the originally disabled page_2 display is now enabled.
$this->drupalGet('test-disabled-display-2');
$result = $this->xpath('//h1');
@@ -86,6 +88,8 @@ class DisabledDisplayTest extends PluginTestBase {
$this->assertFalse($enabled, 'Display ' . $display_id . ' is now disabled');
}
+ \Drupal::service('router.builder')->rebuild();
+
// Check that the page_1 display still works.
$this->drupalGet('test-disabled-display');
$this->assertResponse(200);
diff --git a/core/modules/views/src/Tests/Plugin/DisplayPageTest.php b/core/modules/views/src/Tests/Plugin/DisplayPageTest.php
index 4222f17..373fe5a 100644
--- a/core/modules/views/src/Tests/Plugin/DisplayPageTest.php
+++ b/core/modules/views/src/Tests/Plugin/DisplayPageTest.php
@@ -80,7 +80,7 @@ class DisplayPageTest extends ViewUnitTestBase {
$view->storage->disable()->save();
// Router rebuild would occur in a kernel terminate event so we need to
// simulate that here.
- \Drupal::service('router.builder')->rebuildIfNeeded();
+ \Drupal::service('router.builder')->rebuild();
$response = $this->container->get('http_kernel')->handle($subrequest, HttpKernelInterface::SUB_REQUEST);
$this->assertEqual($response->getStatusCode(), 404);
diff --git a/core/modules/views/src/Tests/Plugin/RelationshipJoinTestBase.php b/core/modules/views/src/Tests/Plugin/RelationshipJoinTestBase.php
index b85c235..5620c0a 100644
--- a/core/modules/views/src/Tests/Plugin/RelationshipJoinTestBase.php
+++ b/core/modules/views/src/Tests/Plugin/RelationshipJoinTestBase.php
@@ -25,6 +25,11 @@ abstract class RelationshipJoinTestBase extends PluginUnitTestBase {
public static $modules = array('system', 'user', 'field');
/**
+ * @var \Drupal\user\Entity\User
+ */
+ protected $rootUser;
+
+ /**
* Overrides \Drupal\views\Tests\ViewUnitTestBase::setUpFixtures().
*/
protected function setUpFixtures() {
@@ -33,9 +38,8 @@ abstract class RelationshipJoinTestBase extends PluginUnitTestBase {
parent::setUpFixtures();
// Create a record for uid 1.
- $this->installSchema('system', 'sequences');
- $root_user = entity_create('user', array('name' => $this->randomMachineName()));
- $root_user->save();
+ $this->rootUser = entity_create('user', array('name' => $this->randomMachineName()));
+ $this->rootUser->save();
Views::viewsData()->clear();
}
diff --git a/core/modules/views/src/Tests/ViewTestData.php b/core/modules/views/src/Tests/ViewTestData.php
index 03c4bae..4b5340e 100644
--- a/core/modules/views/src/Tests/ViewTestData.php
+++ b/core/modules/views/src/Tests/ViewTestData.php
@@ -56,6 +56,9 @@ class ViewTestData {
}
}
}
+
+ // Rebuild the router once.
+ \Drupal::service('router.builder')->rebuild();
}
/**
diff --git a/core/modules/views/src/Tests/ViewUnitTestBase.php b/core/modules/views/src/Tests/ViewUnitTestBase.php
index 16b1e38..2de7f2b 100644
--- a/core/modules/views/src/Tests/ViewUnitTestBase.php
+++ b/core/modules/views/src/Tests/ViewUnitTestBase.php
@@ -36,6 +36,7 @@ abstract class ViewUnitTestBase extends KernelTestBase {
protected function setUp() {
parent::setUp();
+ $this->installSchema('system', array('router', 'sequences'));
$this->setUpFixtures();
}
@@ -59,8 +60,6 @@ abstract class ViewUnitTestBase extends KernelTestBase {
$this->installSchema('views_test_data', $table);
}
- // The router table is required for router rebuilds.
- $this->installSchema('system', array('router'));
\Drupal::service('router.builder')->rebuild();
// Load the test dataset.
diff --git a/core/modules/views/views.module b/core/modules/views/views.module
index 03c27d6..23fd877 100644
--- a/core/modules/views/views.module
+++ b/core/modules/views/views.module
@@ -484,7 +484,7 @@ function views_field_config_delete(FieldConfigInterface $field) {
*/
function views_invalidate_cache() {
// Set the menu as needed to be rebuilt.
- \Drupal::service('router.builder_indicator')->setRebuildNeeded();
+ \Drupal::service('router.builder')->setRebuildNeeded();
$module_handler = \Drupal::moduleHandler();
diff --git a/core/modules/views_ui/src/Tests/DisplayTest.php b/core/modules/views_ui/src/Tests/DisplayTest.php
index eca12a4..1b4d04c 100644
--- a/core/modules/views_ui/src/Tests/DisplayTest.php
+++ b/core/modules/views_ui/src/Tests/DisplayTest.php
@@ -178,6 +178,7 @@ class DisplayTest extends UITestBase {
$this->drupalLogin($this->drupalCreateUser(array('administer views', 'access contextual links')));
$view = entity_load('view', 'test_display');
$view->enable()->save();
+ $this->container->get('router.builder')->rebuildIfNeeded();
$this->drupalGet('test-display');
$id = 'entity.view.edit_form:view=test_display:location=page&name=test_display&display_id=page_1';
diff --git a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
index 2c9a015..84d4266 100644
--- a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
+++ b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
@@ -22,11 +22,11 @@ use Drupal\Tests\UnitTestCase;
class ThemeHandlerTest extends UnitTestCase {
/**
- * The mocked route builder indicator.
+ * The mocked route builder.
*
- * @var \Drupal\Core\Routing\RouteBuilderIndicatorInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var \Drupal\Core\Routing\RouteBuilderInterface|\PHPUnit_Framework_MockObject_MockObject
*/
- protected $routeBuilderIndicator;
+ protected $routeBuilder;
/**
* The mocked info parser.
@@ -111,7 +111,7 @@ class ThemeHandlerTest extends UnitTestCase {
$this->infoParser = $this->getMock('Drupal\Core\Extension\InfoParserInterface');
$this->configInstaller = $this->getMock('Drupal\Core\Config\ConfigInstallerInterface');
$this->configManager = $this->getMock('Drupal\Core\Config\ConfigManagerInterface');
- $this->routeBuilderIndicator = $this->getMock('Drupal\Core\Routing\RouteBuilderIndicatorInterface');
+ $this->routeBuilder = $this->getMock('Drupal\Core\Routing\RouteBuilderInterface');
$this->extensionDiscovery = $this->getMockBuilder('Drupal\Core\Extension\ExtensionDiscovery')
->disableOriginalConstructor()
->getMock();
@@ -119,7 +119,7 @@ class ThemeHandlerTest extends UnitTestCase {
->disableOriginalConstructor()
->getMock();
$logger = $this->getMock('Psr\Log\LoggerInterface');
- $this->themeHandler = new TestThemeHandler($this->root, $this->configFactory, $this->moduleHandler, $this->state, $this->infoParser, $logger, $this->cssCollectionOptimizer, $this->configInstaller, $this->configManager, $this->routeBuilderIndicator, $this->extensionDiscovery);
+ $this->themeHandler = new TestThemeHandler($this->root, $this->configFactory, $this->moduleHandler, $this->state, $this->infoParser, $logger, $this->cssCollectionOptimizer, $this->configInstaller, $this->configManager, $this->routeBuilder, $this->extensionDiscovery);
$cache_tags_invalidator = $this->getMock('Drupal\Core\Cache\CacheTagsInvalidatorInterface');
$this->getContainerWithCacheTagsInvalidator($cache_tags_invalidator);
diff --git a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
index 8502d7e..937be5a 100644
--- a/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
+++ b/core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php
@@ -187,9 +187,6 @@ class LocalTaskManagerTest extends UnitTestCase {
->method('set')
->with('local_task_plugins:en', $definitions, Cache::PERMANENT);
- $this->routeBuilder->expects($this->once())
- ->method('rebuildIfNeeded');
-
$expected_set = $this->getLocalTasksCache();
$this->cacheBackend->expects($this->at(3))
@@ -223,7 +220,7 @@ class LocalTaskManagerTest extends UnitTestCase {
->method('set');
$this->routeBuilder->expects($this->never())
- ->method('rebuildIfNeeded');
+ ->method('rebuild');
$result = $this->getLocalTasksForRouteResult($mock_plugin);
$local_tasks = $this->manager->getLocalTasksForRoute('menu_local_task_test_tasks_view');
diff --git a/core/tests/Drupal/Tests/Core/Routing/NullRouteBuilder.php b/core/tests/Drupal/Tests/Core/Routing/NullRouteBuilder.php
deleted file mode 100644
index 55c00c8..0000000
--- a/core/tests/Drupal/Tests/Core/Routing/NullRouteBuilder.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-
-namespace Drupal\Tests\Core\Routing;
-
-use Drupal\Core\Routing\RouteBuilderInterface;
-
-class NullRouteBuilder implements RouteBuilderInterface {
-
- public function rebuild() {
- }
-
- public function rebuildIfNeeded() {
- }
-
- public function setRebuildNeeded() {
- }
-
- public function getCollectionDuringRebuild() {
- return FALSE;
- }
-
-}
diff --git a/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php b/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php
index b0efe77..b8f212f 100644
--- a/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php
@@ -72,13 +72,6 @@ class RouteBuilderTest extends UnitTestCase {
protected $controllerResolver;
/**
- * The key value store.
- *
- * @var \Drupal\Core\Routing\RouteBuilderIndicatorInterface|\PHPUnit_Framework_MockObject_MockObject
- */
- protected $routeBuilderIndicator;
-
- /**
* @var \Drupal\Core\Access\CheckProviderInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $checkProvider;
@@ -92,10 +85,9 @@ class RouteBuilderTest extends UnitTestCase {
$this->yamlDiscovery = $this->getMockBuilder('\Drupal\Component\Discovery\YamlDiscovery')
->disableOriginalConstructor()
->getMock();
- $this->routeBuilderIndicator = $this->getMock('\Drupal\Core\Routing\RouteBuilderIndicatorInterface');
$this->checkProvider = $this->getMock('\Drupal\Core\Access\CheckProviderInterface');
- $this->routeBuilder = new TestRouteBuilder($this->dumper, $this->lock, $this->dispatcher, $this->moduleHandler, $this->controllerResolver, $this->checkProvider, $this->routeBuilderIndicator);
+ $this->routeBuilder = new TestRouteBuilder($this->dumper, $this->lock, $this->dispatcher, $this->moduleHandler, $this->controllerResolver, $this->checkProvider);
$this->routeBuilder->setYamlDiscovery($this->yamlDiscovery);
}
@@ -112,9 +104,6 @@ class RouteBuilderTest extends UnitTestCase {
->method('release')
->with('router_rebuild');
- $this->routeBuilderIndicator->expects($this->once())
- ->method('setRebuildDone');
-
$this->yamlDiscovery->expects($this->any())
->method('findAll')
->will($this->returnValue(array()));
@@ -262,25 +251,15 @@ class RouteBuilderTest extends UnitTestCase {
/**
* Tests \Drupal\Core\Routing\RouteBuilder::rebuildIfNeeded() method.
*/
- public function testRebuildIfNecessary() {
+ public function testRebuildIfNeeded() {
$this->lock->expects($this->once())
- ->method('acquire')
- ->with('router_rebuild')
- ->will($this->returnValue(TRUE));
+ ->method('acquire')
+ ->with('router_rebuild')
+ ->will($this->returnValue(TRUE));
$this->lock->expects($this->once())
- ->method('release')
- ->with('router_rebuild');
-
- $this->routeBuilderIndicator->expects($this->once())
- ->method('setRebuildNeeded');
-
- $this->routeBuilderIndicator->expects($this->once())
- ->method('setRebuildDone');
-
- $this->routeBuilderIndicator->expects($this->exactly(2))
- ->method('isRebuildNeeded')
- ->will($this->onConsecutiveCalls(TRUE, FALSE));
+ ->method('release')
+ ->with('router_rebuild');
$this->yamlDiscovery->expects($this->any())
->method('findAll')