diff --git a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php index 0708e64..e795080 100644 --- a/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/ConfigImportSubscriber.php @@ -116,6 +116,8 @@ protected function validateModules(ConfigImporter $config_importer) { $config_importer->logError($this->t('Unable to install the %module module since it does not exist.', array('%module' => $module))); } + // Ensure that schema and version of the existing modules that produced the + // source configuration match the site. $existing_modules = array_keys(array_intersect_key($core_extension['module'], $config_importer->getStorageComparer()->getTargetStorage()->read('core.extension')['module'])); foreach ($existing_modules as $module) { if ($core_extension['versions'][$module]['current'] !== $module_data[$module]->info['version']) { @@ -202,6 +204,8 @@ protected function validateThemes(ConfigImporter $config_importer) { } } + // Ensure that version of the existing themes that produced the source + // configuration match the site. $existing_themes = array_keys(array_intersect_key($core_extension['theme'], $config_importer->getStorageComparer()->getTargetStorage()->read('core.extension')['theme'])); foreach ($existing_themes as $theme) { if ($core_extension['versions'][$theme]['current'] !== $theme_data[$theme]->info['version']) { diff --git a/core/modules/system/src/Tests/Extension/ThemeInstallerTest.php b/core/modules/system/src/Tests/Extension/ThemeInstallerTest.php index 6fe81f7..b6b994c 100644 --- a/core/modules/system/src/Tests/Extension/ThemeInstallerTest.php +++ b/core/modules/system/src/Tests/Extension/ThemeInstallerTest.php @@ -269,6 +269,7 @@ function testUninstall() { $this->themeInstaller()->install(array($name)); $this->assertTrue($this->config("$name.settings")->get()); + $this->assertNotNull($this->config('core.extension')->get('versions.test_basetheme'), 'The "test_basetheme" version information is present after install.'); $this->themeInstaller()->uninstall(array($name)); @@ -276,6 +277,7 @@ function testUninstall() { $this->assertFalse(array_keys(system_list('theme'))); $this->assertFalse($this->config("$name.settings")->get()); + $this->assertNull($this->config('core.extension')->get('versions.test_basetheme'), 'The "test_basetheme" version information is not present after uninstall.'); // Ensure that the uninstalled theme can be installed again. $this->themeInstaller()->install(array($name)); diff --git a/core/modules/system/src/Tests/Module/UninstallTest.php b/core/modules/system/src/Tests/Module/UninstallTest.php index 253ea18..de8cd2d 100644 --- a/core/modules/system/src/Tests/Module/UninstallTest.php +++ b/core/modules/system/src/Tests/Module/UninstallTest.php @@ -66,6 +66,10 @@ function testUninstallPage() { // Delete the node to allow node to be uninstalled. $node->delete(); + // Ensure the module information is present in core.extension before + // uninstall. + $this->assertNotNull($this->config('core.extension')->get('versions.module_test'), 'The "module_test" version information is present.'); + // Uninstall module_test. $edit = array(); $edit['uninstall[module_test]'] = TRUE; @@ -76,6 +80,10 @@ function testUninstallPage() { $this->drupalPostForm(NULL, NULL, t('Uninstall')); $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.'); + // Ensure the module information has been removed from core.extension after + // uninstall. + $this->assertNull($this->config('core.extension')->get('versions.module_test'), 'The "module_test" version information has been removed.'); + // Uninstall node testing that the configuration that will be deleted is // listed. $node_dependencies = \Drupal::service('config.manager')->findConfigEntityDependentsAsEntities('module', array('node'));