diff -u b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php --- b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php @@ -102,6 +102,13 @@ $this->kernel = new DrupalKernel('unit_testing', drupal_classloader(), FALSE); $this->kernel->boot(); + // Create a minimal system.module configuration file so that the list of + // enabled modules can be maintained enabling + // \Drupal\Core\Config\ConfigInstaller::installDefaultConfig() to work. + \Drupal::config('system.module') + ->set('enabled', array()) + ->save(); + // Collect and set a fixed module list. $class = get_class($this); $modules = array(); @@ -268,8 +275,11 @@ // Set the list of modules in the extension handler. $module_handler = $this->container->get('module_handler'); $module_filenames = $module_handler->getModuleList(); + $system_config = $this->container->get('config.factory')->get('system.module'); foreach ($modules as $module) { $module_filenames[$module] = drupal_get_filename('module', $module); + // Maintain the list of enabled modules in configuration. + $system_config->set('enabled.' . $module, 0); } $module_handler->setModuleList($module_filenames); $module_handler->resetImplementations(); @@ -284,6 +294,7 @@ $this->pass(format_string('Enabled modules: %modules.', array( '%modules' => implode(', ', $modules), ))); + $system_config->save(); } /**