protected function InstalledConfigurationTest::cleanupConfigurations in Thunder 8.4
Same name and namespace in other branches
- 8.5 tests/src/Functional/InstalledConfigurationTest.php \Drupal\Tests\thunder\Functional\InstalledConfigurationTest::cleanupConfigurations()
- 8.2 tests/src/Functional/InstalledConfigurationTest.php \Drupal\Tests\thunder\Functional\InstalledConfigurationTest::cleanupConfigurations()
- 8.3 tests/src/Functional/InstalledConfigurationTest.php \Drupal\Tests\thunder\Functional\InstalledConfigurationTest::cleanupConfigurations()
- 6.2.x tests/src/Functional/InstalledConfigurationTest.php \Drupal\Tests\thunder\Functional\InstalledConfigurationTest::cleanupConfigurations()
- 6.0.x tests/src/Functional/InstalledConfigurationTest.php \Drupal\Tests\thunder\Functional\InstalledConfigurationTest::cleanupConfigurations()
- 6.1.x tests/src/Functional/InstalledConfigurationTest.php \Drupal\Tests\thunder\Functional\InstalledConfigurationTest::cleanupConfigurations()
Return cleaned-up configurations provided as argument.
Parameters
array $configurations: List of configurations that will be cleaned-up and returned.
string $configurationName: Configuration name for provided configurations.
Return value
array Returns cleaned-up configurations.
1 call to InstalledConfigurationTest::cleanupConfigurations()
- InstalledConfigurationTest::testInstalledConfiguration in tests/
src/ Functional/ InstalledConfigurationTest.php - Compare active configuration with configuration Yaml files.
File
- tests/
src/ Functional/ InstalledConfigurationTest.php, line 316
Class
- InstalledConfigurationTest
- Test for checking of configuration after install of thunder profile.
Namespace
Drupal\Tests\thunder\FunctionalCode
protected function cleanupConfigurations(array $configurations, $configurationName) {
/** @var \Drupal\Core\Config\ExtensionInstallStorage $optionalStorage */
$optionalStorage = \Drupal::service('config_update.extension_optional_storage');
$configCleanup = [];
$ignoreListRules = [];
// Apply ignore for defined configurations and custom properties.
if (array_key_exists($configurationName, static::$ignoreConfigKeys)) {
$configCleanup = static::$ignoreConfigKeys[$configurationName];
}
if (array_key_exists($configurationName, static::$ignoreConfigListValues)) {
foreach (static::$ignoreConfigListValues[$configurationName] as $keyPath => $ignoreValues) {
$ignoreListRules[] = [
'key_path' => explode(static::$configPathSeparator, $keyPath),
'ignore_values' => $ignoreValues,
];
}
}
// Ignore configuration dependencies in case of optional configuration.
if ($optionalStorage
->exists($configurationName)) {
$configCleanup = NestedArray::mergeDeep($configCleanup, [
'dependencies' => TRUE,
]);
}
// If configuration doesn't require cleanup, just return configurations as
// they are.
if (empty($configCleanup) && empty($ignoreListRules)) {
return $configurations;
}
// Apply cleanup for configurations.
foreach ($configurations as $index => $arrayToOverwrite) {
$configurations[$index] = NestedArray::mergeDeep($arrayToOverwrite, $configCleanup);
foreach ($ignoreListRules as $ignoreRule) {
$list = $this
->cleanupConfigList(NestedArray::getValue($configurations[$index], $ignoreRule['key_path']), $ignoreRule['ignore_values']);
NestedArray::setValue($configurations[$index], $ignoreRule['key_path'], $list);
}
}
return $configurations;
}