InstallerConfigDirectorySetNoDirectoryErrorTest.php in Drupal 9
File
core/tests/Drupal/FunctionalTests/Installer/InstallerConfigDirectorySetNoDirectoryErrorTest.php
View source
<?php
namespace Drupal\FunctionalTests\Installer;
use Drupal\Component\Utility\Crypt;
class InstallerConfigDirectorySetNoDirectoryErrorTest extends InstallerTestBase {
protected $defaultTheme = 'stark';
protected $configDirectory;
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,
];
mkdir($this->publicFilesDirectory);
file_put_contents($this->configDirectory, 'Test');
}
protected function setUpSettings() {
}
protected function setUpSite() {
}
public function testError() {
$this
->assertSession()
->pageTextContains("An automated attempt to create the directory {$this->configDirectory}/sync failed, possibly due to a permissions problem.");
$this
->assertDirectoryDoesNotExist($this->configDirectory . '/sync');
}
}