InstallerExistingConfigDirectoryTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. * {@inheritdoc}
  11. */
  12. protected $defaultTheme = 'stark';
  13. /**
  14. * The expected file perms of the folder.
  15. *
  16. * @var int
  17. */
  18. protected $expectedFilePerms;
  19. /**
  20. * {@inheritdoc}
  21. */
  22. protected function prepareEnvironment() {
  23. parent::prepareEnvironment();
  24. mkdir($this->root . DIRECTORY_SEPARATOR . $this->siteDirectory . '/config_read_only', 0444);
  25. $this->expectedFilePerms = fileperms($this->siteDirectory . '/config_read_only');
  26. $this->settings['settings']['config_sync_directory'] = (object) [
  27. 'value' => $this->siteDirectory . '/config_read_only',
  28. 'required' => TRUE,
  29. ];
  30. }
  31. /**
  32. * Verifies that installation succeeded.
  33. */
  34. public function testInstaller() {
  35. $this->assertUrl('user/1');
  36. $this->assertSession()->statusCodeEquals(200);
  37. $this->assertEqual($this->expectedFilePerms, fileperms($this->siteDirectory . '/config_read_only'));
  38. $this->assertEqual([], glob($this->siteDirectory . '/config_read_only/*'), 'The sync directory is empty after install because it is read-only.');
  39. }
  40. }