protected function KernelTestBase::prepareConfigDirectories in SimpleTest 8.3
Create and set new configuration directories.
Return value
string The config sync directory path.
Throws
\RuntimeException Thrown when the configuration sync directory cannot be created or made writable.
See also
\Drupal\Core\Site\Settings::getConfigDirectory()
1 call to KernelTestBase::prepareConfigDirectories()
- KernelTestBase::setUp in src/
KernelTestBase.php - Performs setup tasks before each individual test method is run.
File
- src/
KernelTestBase.php, line 150
Class
- KernelTestBase
- Base class for functional integration tests.
Namespace
Drupal\simpletestCode
protected function prepareConfigDirectories() {
$this->configDirectories = [];
// Assign the relative path to the global variable.
$path = $this->siteDirectory . '/config_' . CONFIG_SYNC_DIRECTORY;
// Ensure the directory can be created and is writeable.
if (!\Drupal::service('file_system')
->prepareDirectory($path, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) {
throw new \RuntimeException("Failed to create '" . CONFIG_SYNC_DIRECTORY . "' config directory {$path}");
}
// Provide the already resolved path for tests.
$this->configDirectories[CONFIG_SYNC_DIRECTORY] = $path;
return $path;
}