diff --git a/core/modules/menu_link_content/src/Tests/Migrate/d6/MigrateMenuLinkTest.php b/core/modules/menu_link_content/src/Tests/Migrate/d6/MigrateMenuLinkTest.php index f6346fc..795f5f0 100644 --- a/core/modules/menu_link_content/src/Tests/Migrate/d6/MigrateMenuLinkTest.php +++ b/core/modules/menu_link_content/src/Tests/Migrate/d6/MigrateMenuLinkTest.php @@ -27,7 +27,6 @@ class MigrateMenuLinkTest extends MigrateDrupal6TestBase { */ protected function setUp() { parent::setUp(); - $this->installSchema('system', ['router']); $this->installEntitySchema('menu_link_content'); $this->executeMigrations(['menu', 'd6_menu_links']); } diff --git a/core/modules/menu_link_content/src/Tests/Migrate/d7/MigrateMenuLinkTest.php b/core/modules/menu_link_content/src/Tests/Migrate/d7/MigrateMenuLinkTest.php index 6b9814a..cd18579 100644 --- a/core/modules/menu_link_content/src/Tests/Migrate/d7/MigrateMenuLinkTest.php +++ b/core/modules/menu_link_content/src/Tests/Migrate/d7/MigrateMenuLinkTest.php @@ -29,7 +29,6 @@ class MigrateMenuLinkTest extends MigrateDrupal7TestBase { */ protected function setUp() { parent::setUp(); - $this->installSchema('system', ['router']); $this->installEntitySchema('menu_link_content'); $this->executeMigration('menu'); } diff --git a/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetTest.php b/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetTest.php index a1fb995..4d43d3a 100644 --- a/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetTest.php +++ b/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetTest.php @@ -35,7 +35,6 @@ class MigrateShortcutSetTest extends MigrateDrupal7TestBase { */ protected function setUp() { parent::setUp(); - $this->installSchema('system', array('router')); $this->installEntitySchema('shortcut'); $this->installEntitySchema('menu_link_content'); $this->executeMigration('d7_shortcut_set'); diff --git a/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetUsersTest.php b/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetUsersTest.php index c6d4530..18318ed 100644 --- a/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetUsersTest.php +++ b/core/modules/shortcut/src/Tests/Migrate/d7/MigrateShortcutSetUsersTest.php @@ -34,7 +34,6 @@ class MigrateShortcutSetUsersTest extends MigrateDrupal7TestBase { */ protected function setUp() { parent::setUp(); - $this->installSchema('system', array('router')); $this->installEntitySchema('shortcut'); $this->installEntitySchema('menu_link_content'); $this->installSchema('shortcut', ['shortcut_set_users']); diff --git a/core/modules/simpletest/src/RouteBuilder.php b/core/modules/simpletest/src/RouteBuilder.php index dea8cde..79441b4 100644 --- a/core/modules/simpletest/src/RouteBuilder.php +++ b/core/modules/simpletest/src/RouteBuilder.php @@ -21,18 +21,30 @@ class RouteBuilder implements RouteBuilderInterface, DestructableInterface { use DependencySerializationTrait; /** + * @var bool + */ + protected $tableInstalled; + + /** * Loads the router builder and installs the router table. * - * @return object - * Returns the constructed real service. + * @param bool $table_needed + * TRUE when the table needs to be installed. + * + * @return \Drupal\Core\Routing\RouteBuilderInterface|\Drupal\Core\DestructableInterface + * Returns the real route builder. */ - protected function lazyLoadItself() { + protected function lazyLoadItself($table_needed = FALSE) { if (!isset($this->service)) { $container = \Drupal::getContainer(); $this->service = $container->get('simpletest.router.builder'); + } + if ($table_needed && !$this->tableInstalled) { $schema = $container->get('database')->schema(); if (!$schema->tableExists('router')) { - $schema->createTable('router', drupal_get_module_schema('system', 'router')); + include_once $container->get('app.root') . '/core/modules/system/system.install'; + $schema->createTable('router', system_schema()['router']); + $this->tableInstalled = TRUE; } } return $this->service; @@ -49,7 +61,7 @@ public function setRebuildNeeded() { * {@inheritdoc} */ public function rebuild() { - return $this->lazyLoadItself()->rebuild(); + return $this->lazyLoadItself(TRUE)->rebuild(); } /** diff --git a/core/modules/system/src/Tests/File/StreamWrapperTest.php b/core/modules/system/src/Tests/File/StreamWrapperTest.php index 343cd83..5816861 100644 --- a/core/modules/system/src/Tests/File/StreamWrapperTest.php +++ b/core/modules/system/src/Tests/File/StreamWrapperTest.php @@ -102,7 +102,6 @@ function testUriFunctions() { // Test file_create_url() // TemporaryStream::getExternalUrl() uses Url::fromRoute(), which needs // route information to work. - $this->installSchema('system', 'router'); $this->container->get('router.builder')->rebuild(); $this->assertTrue(strpos(file_create_url('temporary://test.txt'), 'system/temporary?file=test.txt'), 'Temporary external URL correctly built.'); $this->assertTrue(strpos(file_create_url('public://test.txt'), Settings::get('file_public_path') . '/test.txt'), 'Public external URL correctly built.'); diff --git a/core/modules/system/src/Tests/System/TokenReplaceUnitTestBase.php b/core/modules/system/src/Tests/System/TokenReplaceUnitTestBase.php index 84b5041..a8cd490 100644 --- a/core/modules/system/src/Tests/System/TokenReplaceUnitTestBase.php +++ b/core/modules/system/src/Tests/System/TokenReplaceUnitTestBase.php @@ -39,7 +39,6 @@ protected function setUp() { parent::setUp(); // Install default system configuration. $this->installConfig(array('system')); - $this->installSchema('system', array('router')); $this->interfaceLanguage = \Drupal::languageManager()->getCurrentLanguage(); $this->tokenService = \Drupal::token(); }