diff -u b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php --- b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php +++ b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php @@ -25,9 +25,6 @@ */ protected function getAllFolders() { if (!isset($this->folders)) { - // Don't think we need to worry about profile because it is an enabled - // module and any modules it has will also be enabled or not. - // $this->folders = $this->getComponentNames('profile', array(drupal_get_profile())); $this->folders = $this->getComponentNames('module', array_keys(\Drupal::moduleHandler()->getModuleList())); $this->folders += $this->getComponentNames('theme', array_keys(array_filter(list_themes(TRUE), function ($theme) {return $theme->status;}))); } @@ -35,7 +32,7 @@ } /** - * Overrides \Drupal\Core\Config\InstallStorage::write(). + * {@inheritdoc} * * @throws \Drupal\Core\Config\StorageException */ @@ -44,7 +41,7 @@ } /** - * Overrides \Drupal\Core\Config\InstallStorage::delete(). + * {@inheritdoc} * * @throws \Drupal\Core\Config\StorageException */ @@ -53,7 +50,7 @@ } /** - * Overrides \Drupal\Core\Config\InstallStorage::rename(). + * {@inheritdoc} * * @throws \Drupal\Core\Config\StorageException */ diff -u b/core/modules/config/lib/Drupal/config/Tests/ConfigOtherModuleTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigOtherModuleTest.php --- b/core/modules/config/lib/Drupal/config/Tests/ConfigOtherModuleTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigOtherModuleTest.php @@ -21,7 +21,7 @@ public static function getInfo() { return array( - 'name' => 'Default configuration other modules', + 'name' => 'Default configuration provider for config_test', 'description' => 'Tests default configuration provided by a module that does not own it.', 'group' => 'Configuration', ); @@ -34,34 +34,50 @@ public function testInstallOtherModule() { $this->moduleHandler->enable(array('config_other_module_config')); - // We can not use this entity system because the config_test entity type - // does not exist. + + // Check that the config entity doesn't exist before the config_test module + // is enabled. We can not use the entity system because the config_test + // entity type does not exist. $config = \Drupal::config('config_test.dynamic.other_module'); $this->assertTrue($config->isNew(), 'Default configuration for other modules is not installed if that module is not enabled.'); // Install the module that provides the entity type. This installs the // default configuration. $this->moduleHandler->enable(array('config_test')); - $other_module_config_entity = entity_load('config_test', 'other_module'); - $this->assertTrue($other_module_config_entity); + $this->assertTrue(entity_load('config_test', 'other_module', TRUE),'Default configuration has been installed.'); + + // Uninstall the module that provides the entity type. This will remove the + // default configuration. + $this->moduleHandler->disable(array('config_test')); + $this->moduleHandler->uninstall(array('config_test')); + $config = \Drupal::config('config_test.dynamic.other_module'); + $this->assertTrue($config->isNew(), 'Default configuration for other modules is removed when the config entity provider is disabled.'); + + // Install the module that provides the entity type again. This installs the + // default configuration. + $this->moduleHandler->enable(array('config_test')); + $other_module_config_entity = entity_load('config_test', 'other_module', TRUE); + $this->assertTrue($other_module_config_entity, "Default configuration has been recreated."); + + // Update the default configuration. To test that the changes are preserved + // if the module that provides the default configuration is uninstalled. $other_module_config_entity->set('style', "The piano ain't got no wrong notes."); $other_module_config_entity->save(); + $config = \Drupal::config('config_test.dynamic.other_module'); + $this->assertTrue($config->isNew(), 'Default configuration for other modules is not installed if that module is not enabled.'); - // Uninstall the module that provides the default configuration. This will - // not remove the default config entity provided by it. + // Uninstall the module that provides the default configuration. $this->moduleHandler->disable(array('config_other_module_config')); $this->moduleHandler->uninstall(array('config_other_module_config')); $this->assertTrue(entity_load('config_test', 'other_module', TRUE), 'Default configuration for other modules is not removed when the module that provides it is uninstalled.'); // Default configuration provided by config_test should still exist. - $this->assertTrue(entity_load('config_test', 'dotted.default', TRUE), 'Other configuration is left alone.'); + $this->assertTrue(entity_load('config_test', 'dotted.default', TRUE), 'The configuration is not deleted.'); - // Re-enable module to test that default config for other modules is - // unchanged if it existed already. + // Re-enable module to test that default config is unchanged. $this->moduleHandler->enable(array('config_other_module_config')); $config_entity = entity_load('config_test', 'other_module', TRUE); $this->assertEqual($config_entity->get('style'), "The piano ain't got no wrong notes.", 'Re-enabling the module does not install default config over the existing config entity.'); - } }