function InstallerConfigDirectorySetNoDirectoryErrorTest::prepareEnvironment

Same name and namespace in other branches
  1. 9 core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php \Drupal\FunctionalTests\Installer\InstallerConfigDirectorySetNoDirectoryErrorTest::prepareEnvironment()
  2. 8.9.x core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php \Drupal\FunctionalTests\Installer\InstallerConfigDirectorySetNoDirectoryErrorTest::prepareEnvironment()
  3. 10 core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php \Drupal\FunctionalTests\Installer\InstallerConfigDirectorySetNoDirectoryErrorTest::prepareEnvironment()

Overrides FunctionalTestSetupTrait::prepareEnvironment

File

core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php, line 31

Class

InstallerConfigDirectorySetNoDirectoryErrorTest
Tests installation when a config_sync_directory is set up but does not exist.

Namespace

Drupal\FunctionalTests\Installer

Code

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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.