protected function InstallerConfigDirectorySetNoDirectoryErrorTest::prepareEnvironment in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php \Drupal\FunctionalTests\Installer\InstallerConfigDirectorySetNoDirectoryErrorTest::prepareEnvironment()
- 10 core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php \Drupal\FunctionalTests\Installer\InstallerConfigDirectorySetNoDirectoryErrorTest::prepareEnvironment()
Prepares the current environment for running the test.
Also sets up new resources for the testing environment, such as the public filesystem and configuration directories.
This method is private as it must only be called once by BrowserTestBase::setUp() (multiple invocations for the same test would have unpredictable consequences) and it must not be callable or overridable by test classes.
Overrides FunctionalTestSetupTrait::prepareEnvironment
File
- core/
tests/ Drupal/ FunctionalTests/ Installer/ InstallerConfigDirectorySetNoDirectoryErrorTest.php, line 29
Class
- InstallerConfigDirectorySetNoDirectoryErrorTest
- Tests installation when a config_sync_directory is set up but does not exist.
Namespace
Drupal\FunctionalTests\InstallerCode
protected function prepareEnvironment() {
parent::prepareEnvironment();
$this->configDirectory = $this->publicFilesDirectory . '/config_' . Crypt::randomBytesBase64();
$this->settings['settings']['config_sync_directory'] = (object) [
'value' => $this->configDirectory . '/sync',
'required' => TRUE,
];
// Create the files directory early so we can test the error case.
mkdir($this->publicFilesDirectory);
// Create a file so the directory can not be created.
file_put_contents($this->configDirectory, 'Test');
}