InstallerSkipPermissionHardeningTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 function prepareEnvironment() {
  13. parent::prepareEnvironment();
  14. $this->settings['settings']['skip_permissions_hardening'] = (object) ['value' => TRUE, 'required' => TRUE];
  15. }
  16. /**
  17. * {@inheritdoc}
  18. */
  19. protected function setUpSite() {
  20. $site_directory = $this->container->get('app.root') . '/' . $this->siteDirectory;
  21. $this->assertTrue(is_writable($site_directory));
  22. $this->assertTrue(is_writable($site_directory . '/settings.php'));
  23. $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>.');
  24. parent::setUpSite();
  25. }
  26. /**
  27. * Verifies the expected behaviors of the installation result.
  28. */
  29. public function testInstalled() {
  30. $this->assertSession()->addressEquals('user/1');
  31. $this->assertSession()->statusCodeEquals(200);
  32. }
  33. }