InstallerConfigDirectorySetNoDirectoryTest.php 1.4 KB

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