function ConfigInstallProfileUnmetDependenciesTest::copyTestingOverrides
Same name in other branches
- 9 core/modules/config/tests/src/Functional/ConfigInstallProfileUnmetDependenciesTest.php \Drupal\Tests\config\Functional\ConfigInstallProfileUnmetDependenciesTest::copyTestingOverrides()
- 8.9.x core/modules/config/tests/src/Functional/ConfigInstallProfileUnmetDependenciesTest.php \Drupal\Tests\config\Functional\ConfigInstallProfileUnmetDependenciesTest::copyTestingOverrides()
- 10 core/modules/config/tests/src/Functional/ConfigInstallProfileUnmetDependenciesTest.php \Drupal\Tests\config\Functional\ConfigInstallProfileUnmetDependenciesTest::copyTestingOverrides()
Copy the testing_config_overrides install profile.
So we can change the configuration to include a dependency that can not be met. File API functions are not available yet.
1 call to ConfigInstallProfileUnmetDependenciesTest::copyTestingOverrides()
- ConfigInstallProfileUnmetDependenciesTest::prepareEnvironment in core/
modules/ config/ tests/ src/ Functional/ ConfigInstallProfileUnmetDependenciesTest.php
File
-
core/
modules/ config/ tests/ src/ Functional/ ConfigInstallProfileUnmetDependenciesTest.php, line 75
Class
- ConfigInstallProfileUnmetDependenciesTest
- Tests install profile config overrides can not add unmet dependencies.
Namespace
Drupal\Tests\config\FunctionalCode
protected function copyTestingOverrides() : void {
$dest = $this->siteDirectory . '/profiles/testing_config_overrides';
mkdir($dest, 0777, TRUE);
$source = DRUPAL_ROOT . '/core/profiles/testing_config_overrides';
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $item) {
if ($item->isDir()) {
mkdir($dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
}
else {
copy((string) $item, $dest . DIRECTORY_SEPARATOR . $iterator->getSubPathName());
}
}
// Add a dependency that can not be met.
$config_file = $dest . DIRECTORY_SEPARATOR . InstallStorage::CONFIG_INSTALL_DIRECTORY . DIRECTORY_SEPARATOR . 'system.action.user_block_user_action.yml';
$action = Yaml::decode(file_get_contents($config_file));
$action['dependencies']['module'][] = 'does_not_exist';
file_put_contents($config_file, Yaml::encode($action));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.