InstallerExistingConfigDirectoryTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace Drupal\FunctionalTests\Installer;
  3. /**
  4. * Tests the installer when a config_directory has already been set up.
  5. *
  6. * @group Installer
  7. */
  8. class InstallerExistingConfigDirectoryTest extends InstallerTestBase {
  9. /**
  10. * The expected file perms of the folder.
  11. *
  12. * @var int
  13. */
  14. protected $expectedFilePerms;
  15. /**
  16. * {@inheritdoc}
  17. */
  18. protected function prepareEnvironment() {
  19. parent::prepareEnvironment();
  20. mkdir($this->root . DIRECTORY_SEPARATOR . $this->siteDirectory . '/config_read_only', 0444);
  21. $this->expectedFilePerms = fileperms($this->siteDirectory . '/config_read_only');
  22. $this->settings['config_directories'][CONFIG_SYNC_DIRECTORY] = (object) [
  23. 'value' => $this->siteDirectory . '/config_read_only',
  24. 'required' => TRUE,
  25. ];
  26. }
  27. /**
  28. * Verifies that installation succeeded.
  29. */
  30. public function testInstaller() {
  31. $this->assertUrl('user/1');
  32. $this->assertResponse(200);
  33. $this->assertEqual($this->expectedFilePerms, fileperms($this->siteDirectory . '/config_read_only'));
  34. $this->assertEqual([], glob($this->siteDirectory . '/config_read_only/*'), 'The sync directory is empty after install because it is read-only.');
  35. }
  36. }