3 namespace Drupal\FunctionalTests\Installer;
5 use Drupal\Component\Utility\Crypt;
8 * Tests the installer when a config_directory set up but does not exist.
12 class InstallerConfigDirectorySetNoDirectoryErrorTest extends InstallerTestBase {
15 * The directory where the sync directory should be created during install.
19 protected $configDirectory;
24 protected function prepareEnvironment() {
25 parent::prepareEnvironment();
26 $this->configDirectory = $this->publicFilesDirectory . '/config_' . Crypt::randomBytesBase64();
27 $this->settings['config_directories'][CONFIG_SYNC_DIRECTORY] = (object) [
28 'value' => $this->configDirectory . '/sync',
31 // Create the files directory early so we can test the error case.
32 mkdir($this->publicFilesDirectory);
33 // Create a file so the directory can not be created.
34 file_put_contents($this->configDirectory, 'Test');
38 * Installer step: Configure settings.
40 protected function setUpSettings() {
41 // This step should not appear as we had a failure prior to the settings
48 protected function setUpSite() {
49 // This step should not appear as we had a failure prior to the settings
54 * Verifies that installation failed.
56 public function testError() {
57 $this->assertText("An automated attempt to create the directory {$this->configDirectory}/sync failed, possibly due to a permissions problem.");
58 $this->assertFalse(file_exists($this->configDirectory . '/sync') && is_dir($this->configDirectory . '/sync'), "The directory {$this->configDirectory}/sync does not exist.");