diff -u b/core/includes/config.inc b/core/includes/config.inc --- b/core/includes/config.inc +++ b/core/includes/config.inc @@ -24,7 +24,10 @@ * The name of the module or theme to install default configuration for. */ function config_install_default_config($type, $name) { - // Get all default configuration owned by this extension. + // Get all default configuration owned by this extension. This will return any + // configuration that starts with the extension name that exists in any + // enabled extension's config directory. This includes the extension that is + // being installed. $source_storage = new ExtensionInstallStorage(); $config_to_install = $source_storage->listAll($name . '.'); @@ -42,7 +45,7 @@ $enabled_extensions += array_keys(array_filter(list_themes(), function ($theme) {return $theme->status;})); $other_module_config = array_filter($other_module_config, function ($config_name) use ($enabled_extensions) { - $provider = Unicode::substr($config_name,0, strpos($config_name, '.')); + $provider = Unicode::substr($config_name, 0, strpos($config_name, '.')); return in_array($provider, $enabled_extensions); }); 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 @@ -27,12 +27,18 @@ ); } + /** + * Sets up the module handler for enabling and disabling modules. + */ public function setUp() { parent::setUp(); $this->moduleHandler = $this->container->get('module_handler'); } - public function testInstallOtherModule() { + /** + * Tests enabling the provider of the default configuration first. + */ + public function testInstallOtherModuleFirst() { $this->moduleHandler->enable(array('config_other_module_config')); // Check that the config entity doesn't exist before the config_test module @@ -44,7 +50,7 @@ // Install the module that provides the entity type. This installs the // default configuration. $this->moduleHandler->enable(array('config_test')); - $this->assertTrue(entity_load('config_test', 'other_module', TRUE),'Default configuration has been installed.'); + $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. @@ -80,2 +86,13 @@ + /** + * Tests enabling the provider of the config entity type first. + */ + public function testInstallConfigEnityModuleFirst() { + $this->moduleHandler->enable(array('config_test')); + $this->assertFalse(entity_load('config_test', 'other_module', TRUE), 'Default configuration provided by config_other_module_config does not exist.'); + + $this->moduleHandler->enable(array('config_other_module_config')); + $this->assertTrue(entity_load('config_test', 'other_module', TRUE), 'Default configuration provided by config_other_module_config has been installed.'); + } + }