11febf2d6f0a30007bbf88a589e22a55c5a33bd5
[yaffs-website] / web / core / modules / system / src / Tests / Installer / InstallerConfigDirectorySetNoDirectoryTest.php
1 <?php
2
3 namespace Drupal\system\Tests\Installer;
4
5 use Drupal\Component\Utility\Crypt;
6 use Drupal\simpletest\InstallerTestBase;
7
8 /**
9  * Tests the installer when a config_directory set up but does not exist.
10  *
11  * @group Installer
12  */
13 class InstallerConfigDirectorySetNoDirectoryTest extends InstallerTestBase {
14
15   /**
16    * The sync directory created during the install.
17    *
18    * @var string
19    */
20   protected $syncDirectory;
21
22   /**
23    * {@inheritdoc}
24    */
25   protected function setUp() {
26     $this->syncDirectory = $this->publicFilesDirectory . '/config_' . Crypt::randomBytesBase64() . '/sync';
27     $this->settings['config_directories'][CONFIG_SYNC_DIRECTORY] = (object) [
28       'value' => $this->syncDirectory,
29       'required' => TRUE,
30     ];
31     // Other directories will be created too.
32     $this->settings['config_directories']['custom'] = (object) [
33       'value' => $this->publicFilesDirectory . '/config_custom',
34       'required' => TRUE,
35     ];
36     parent::setUp();
37   }
38
39   /**
40    * Verifies that installation succeeded.
41    */
42   public function testInstaller() {
43     $this->assertUrl('user/1');
44     $this->assertResponse(200);
45     $this->assertTrue(file_exists($this->syncDirectory) && is_dir($this->syncDirectory), "The directory {$this->syncDirectory} exists.");
46     $this->assertTrue(file_exists($this->publicFilesDirectory . '/config_custom') && is_dir($this->publicFilesDirectory . '/config_custom'), "The directory {$this->publicFilesDirectory}/custom_config exists.");
47   }
48
49 }