Issue #2989884 by chr.fritsch, alexpott, phenaproxima: Re-installing the media_library doesn't work

8.7.x
Alex Pott 2018-08-06 10:30:35 +01:00
parent b102bc2e9f
commit d712f83e2c
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
2 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,9 @@
langcode: en langcode: en
status: true status: true
dependencies: dependencies:
enforced:
module:
- media_library
module: module:
- media - media
id: media.media_library id: media.media_library

View File

@ -109,16 +109,18 @@ abstract class ModuleTestBase extends BrowserTestBase {
} }
$this->assertTrue($all_names); $this->assertTrue($all_names);
$module_config_dependencies = \Drupal::service('config.manager')->findConfigEntityDependents('module', [$module]);
// Look up each default configuration object name in the active // Look up each default configuration object name in the active
// configuration, and if it exists, remove it from the stack. // configuration, and if it exists, remove it from the stack.
// Only default config that belongs to $module is guaranteed to exist; any $names = $module_file_storage->listAll();
// other default config depends on whether other modules are enabled. Thus,
// list all default config once more, but filtered by $module.
$names = $module_file_storage->listAll($module . '.');
foreach ($names as $key => $name) { foreach ($names as $key => $name) {
if ($this->config($name)->get()) { if ($this->config($name)->get()) {
unset($names[$key]); unset($names[$key]);
} }
// All configuration in a module's config/install directory should depend
// on the module as it must be removed on uninstall or the module will not
// be re-installable.
$this->assertTrue(strpos($name, $module . '.') === 0 || isset($module_config_dependencies[$name]), "Configuration $name provided by $module in its config/install directory does not depend on it.");
} }
// Verify that all configuration has been installed (which means that $names // Verify that all configuration has been installed (which means that $names
// is empty). // is empty).