diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index a7ea9db5d0..67e445d53f 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -309,7 +309,6 @@ public function install(array $module_list, $enable_dependencies = TRUE) { // If any modules were newly installed, invoke hook_modules_installed(). if (!empty($modules_installed)) { - \Drupal::getContainer()->set('router.route_provider', \Drupal::service('router.route_provider.old')); // There will be a new config factory. $extension_config = \Drupal::configFactory()->getEditable('core.extension'); // Update version information in configuration. @@ -324,7 +323,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) { } ksort($versions); $extension_config->set('versions', $versions)->save(); - + \Drupal::getContainer()->set('router.route_provider', \Drupal::service('router.route_provider.old')); if (!\Drupal::service('router.route_provider.lazy_builder')->hasRebuilt()) { // Rebuild routes after installing module. This is done here on top of // \Drupal\Core\Routing\RouteBuilder::destruct to not run into errors on diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php index cbf8a45f0f..e034403398 100644 --- a/core/modules/simpletest/src/KernelTestBase.php +++ b/core/modules/simpletest/src/KernelTestBase.php @@ -263,7 +263,6 @@ protected function setUp() { 'profile' => '', ]); - // Collect and set a fixed module list. $class = get_class($this); $modules = []; diff --git a/core/modules/system/src/Tests/Update/VersionInfoUpdateTest.php b/core/modules/system/src/Tests/Update/VersionInfoUpdateTest.php index 17132e4924..737dba463f 100644 --- a/core/modules/system/src/Tests/Update/VersionInfoUpdateTest.php +++ b/core/modules/system/src/Tests/Update/VersionInfoUpdateTest.php @@ -1,10 +1,5 @@ getEditable('core.extension'); $versions = $core->get('versions') ?: []; diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php index db968a5ebb..95ab85837a 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBase.php +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php @@ -387,12 +387,28 @@ private function bootKernel() { // Setup the destion to the be frontpage by default. \Drupal::destination()->set('/'); + // Get the module version information. + $listing = new ExtensionDiscovery(\Drupal::root()); + $module_list = $listing->scan('module'); + // In ModuleHandlerTest we pass in a profile as if it were a module. + $module_list += $listing->scan('profile'); + + $versions = []; + foreach ($modules as $module) { + $version = \Drupal::service('info_parser')->parse($module_list[$module]->getPathname())['version']; + $versions[$module] = [ + 'current' => $version, + 'schema' => (string) SCHEMA_UNINSTALLED, + ]; + } + // Write the core.extension configuration. // Required for ConfigInstaller::installDefaultConfig() to work. $this->container->get('config.storage')->write('core.extension', [ 'module' => array_fill_keys($modules, 0), 'theme' => [], 'profile' => '', + 'versions' => $versions, ]); $settings = Settings::getAll(); diff --git a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php index 01e9c69faa..4ab049d4e6 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php +++ b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php @@ -212,7 +212,6 @@ public function testRenderWithTheme() { } /** -<<<<<<< HEAD * @covers ::bootKernel */ public function testFileDefaultScheme() { @@ -276,7 +275,8 @@ public function testRequiresModule() { try { $stub_test->publicCheckRequirements(); $this->fail('Missing required module throws skipped test exception.'); - } catch (\PHPUnit_Framework_SkippedTestError $e) { + } + catch (\PHPUnit_Framework_SkippedTestError $e) { $this->assertEqual('Required modules: module_does_not_exist', $e->getMessage()); } } diff --git a/core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php b/core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php index b719ab4da8..590a5ce6e7 100644 --- a/core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/DefaultConfigTest.php @@ -27,8 +27,8 @@ public function testConfigIsEmpty() { $expected = [ 'module' => [], 'theme' => [], - 'versions' => [], 'profile' => '', + 'versions' => [], ]; $this->assertEquals($expected, $config); }