diff --git a/core/modules/system/tests/src/Functional/System/SitesDirectoryHardeningTest.php b/core/modules/system/tests/src/Functional/System/SitesDirectoryHardeningTest.php index 78e220e12e7626a349a2b8617a0b3fe82da89fee..b8b25652d7fbd980ecc84cfb83c8c5976b3c1b38 100644 --- a/core/modules/system/tests/src/Functional/System/SitesDirectoryHardeningTest.php +++ b/core/modules/system/tests/src/Functional/System/SitesDirectoryHardeningTest.php @@ -65,8 +65,10 @@ public function testSitesDirectoryHardeningConfig() { $this->assertStringContainsString('settings.php is not protected from modifications and poses a security risk.', $description); $this->assertStringContainsString('services.yml is not protected from modifications and poses a security risk.', $description); - $this->assertTrue(is_writable($site_path), 'Site directory remains writable when automatically fixing permissions is disabled.'); - $this->assertTrue(is_writable($settings_file), 'settings.php remains writable when automatically fixing permissions is disabled.'); + // Verify that site directory and the settings.php remain writable when + // automatically enforcing file permissions is disabled. + $this->assertDirectoryIsWritable($site_path); + $this->assertFileIsWritable($settings_file); // Re-enable permissions enforcement. $settings = Settings::getAll(); @@ -77,8 +79,10 @@ public function testSitesDirectoryHardeningConfig() { $requirements = $this->checkSystemRequirements(); $this->assertEquals('Protected', (string) $requirements['configuration_files']['value']); - $this->assertFalse(is_writable($site_path), 'Site directory is protected when automatically fixing permissions is enabled.'); - $this->assertFalse(is_writable($settings_file), 'settings.php is protected when automatically fixing permissions is enabled.'); + // Verify that site directory and the settings.php remain protected when + // automatically enforcing file permissions is enabled. + $this->assertDirectoryNotIsWritable($site_path); + $this->assertFileNotIsWritable($settings_file); } /** diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php index 13dec4b97f63393ef93e1a2dc6bd417a9e95a610..aa81b33e7f1fc3c28530eff82cf7fbb6d033dbd4 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php @@ -27,8 +27,8 @@ protected function prepareEnvironment() { */ protected function setUpSite() { $site_directory = $this->container->getParameter('app.root') . '/' . $this->siteDirectory; - $this->assertTrue(is_writable($site_directory)); - $this->assertTrue(is_writable($site_directory . '/settings.php')); + $this->assertDirectoryIsWritable($site_directory); + $this->assertFileIsWritable($site_directory . '/settings.php'); $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>.'); diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php index 570354028cf87636c048a9abbfb5355fd0db4385..b3ad24452927ebf713800402a145cd4252752026 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php +++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php @@ -95,8 +95,8 @@ protected function setUpSite() { // Test that SiteConfigureForm::buildForm() has made the site directory and // the settings file non-writable. $site_directory = $this->container->getParameter('app.root') . '/' . $this->siteDirectory; - $this->assertFalse(is_writable($site_directory)); - $this->assertFalse(is_writable($site_directory . '/settings.php')); + $this->assertDirectoryNotIsWritable($site_directory); + $this->assertFileNotIsWritable($site_directory . '/settings.php'); parent::setUpSite(); } diff --git a/core/tests/Drupal/Tests/Core/Image/ImageTest.php b/core/tests/Drupal/Tests/Core/Image/ImageTest.php index c7b5769e4c8ea9edffa78db14807075ebefe4ac1..f9c899e5b36b1ebfb45d18fdefdbd03cbdd66007 100644 --- a/core/tests/Drupal/Tests/Core/Image/ImageTest.php +++ b/core/tests/Drupal/Tests/Core/Image/ImageTest.php @@ -188,7 +188,7 @@ public function testGetMimeType() { public function testIsValid() { $this->getTestImage(FALSE); $this->assertTrue($this->image->isValid()); - $this->assertTrue(is_readable($this->image->getSource())); + $this->assertFileIsReadable($this->image->getSource()); } /**