InstallerSkipPermissionHardeningTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace Drupal\FunctionalTests\Installer;
  3. /**
  4. * Verifies that the installer skipped permission hardening.
  5. *
  6. * @group Installer
  7. */
  8. class InstallerSkipPermissionHardeningTest extends InstallerTestBase {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. protected $defaultTheme = 'stark';
  13. /**
  14. * {@inheritdoc}
  15. */
  16. protected function prepareEnvironment() {
  17. parent::prepareEnvironment();
  18. $this->settings['settings']['skip_permissions_hardening'] = (object) ['value' => TRUE, 'required' => TRUE];
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. protected function setUpSite() {
  24. $site_directory = $this->container->get('app.root') . '/' . $this->siteDirectory;
  25. $this->assertDirectoryIsWritable($site_directory);
  26. $this->assertFileIsWritable($site_directory . '/settings.php');
  27. $this->assertSession()->responseContains('All necessary changes to <em class="placeholder">' . $this->siteDirectory . '</em> and <em class="placeholder">' . $this->siteDirectory . '/settings.php</em> have been made, so you should remove write permissions to them now in order to avoid security risks. If you are unsure how to do so, consult the <a href="https://www.drupal.org/server-permissions">online handbook</a>.');
  28. parent::setUpSite();
  29. }
  30. /**
  31. * Verifies the expected behaviors of the installation result.
  32. */
  33. public function testInstalled() {
  34. $this->assertSession()->addressEquals('user/1');
  35. $this->assertSession()->statusCodeEquals(200);
  36. }
  37. }