Commit 8a1341ac authored by catch's avatar catch

Issue #2718733 by alexpott: ConfigInstaller can create configuration files...

Issue #2718733 by alexpott: ConfigInstaller can create configuration files which have unmet dependencies
parent fe94d15d
......@@ -511,6 +511,7 @@ protected function findDefaultConfigWithUnmetDependencies(StorageInterface $stor
* TRUE if the dependencies are met, FALSE if not.
*/
protected function validateDependencies($config_name, array $data, array $enabled_extensions, array $all_config) {
list($provider) = explode('.', $config_name, 2);
if (isset($data['dependencies'])) {
$all_dependencies = $data['dependencies'];
......@@ -521,7 +522,6 @@ protected function validateDependencies($config_name, array $data, array $enable
}
// Ensure the configuration entity type provider is in the list of
// dependencies.
list($provider) = explode('.', $config_name, 2);
if (!isset($all_dependencies['module'])) {
$all_dependencies['module'][] = $provider;
}
......@@ -548,6 +548,10 @@ protected function validateDependencies($config_name, array $data, array $enable
}
}
}
else {
// Simple config or a config entity without dependencies.
return in_array($provider, $enabled_extensions, TRUE);
}
return TRUE;
}
......
......@@ -180,7 +180,7 @@ public function testUnmetDependenciesInstall() {
// not depend on config_test and order is important.
$this->drupalPostForm('admin/modules', array('modules[Testing][config_test][enable]' => TRUE), t('Install'));
$this->drupalPostForm('admin/modules', array('modules[Testing][config_install_dependency_test][enable]' => TRUE), t('Install'));
$this->assertRaw('Unable to install Config install dependency test, <em class="placeholder">config_test.dynamic.other_module_test_with_dependency</em> has unmet dependencies.');
$this->assertRaw('Unable to install Config install dependency test, <em class="placeholder">config_other_module_config_test.weird_simple_config, config_test.dynamic.other_module_test_with_dependency</em> have unmet dependencies.');
$this->drupalPostForm('admin/modules', array('modules[Testing][config_other_module_config_test][enable]' => TRUE), t('Install'));
$this->drupalPostForm('admin/modules', array('modules[Testing][config_install_dependency_test][enable]' => TRUE), t('Install'));
......
config_other_module_config_test.weird_simple_config:
type: config_object
mapping:
foo:
type: string
......@@ -199,8 +199,8 @@ public function testDependencyChecking() {
}
catch (UnmetDependenciesException $e) {
$this->assertEqual($e->getExtension(), 'config_install_dependency_test');
$this->assertEqual($e->getConfigObjects(), ['config_test.dynamic.other_module_test_with_dependency']);
$this->assertEqual($e->getMessage(), 'Configuration objects (config_test.dynamic.other_module_test_with_dependency) provided by config_install_dependency_test have unmet dependencies');
$this->assertEqual($e->getConfigObjects(), ['config_other_module_config_test.weird_simple_config', 'config_test.dynamic.other_module_test_with_dependency']);
$this->assertEqual($e->getMessage(), 'Configuration objects (config_other_module_config_test.weird_simple_config, config_test.dynamic.other_module_test_with_dependency) provided by config_install_dependency_test have unmet dependencies');
}
$this->installModules(['config_other_module_config_test']);
$this->installModules(['config_install_dependency_test']);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment