diff --git a/core/modules/system/tests/src/Functional/System/SitesDirectoryHardeningTest.php b/core/modules/system/tests/src/Functional/System/SitesDirectoryHardeningTest.php
index 78e220e12e7..b8b25652d7f 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 @@ class SitesDirectoryHardeningTest extends BrowserTestBase {
$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 @@ class SitesDirectoryHardeningTest extends BrowserTestBase {
$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 13dec4b97f6..aa81b33e7f1 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerSkipPermissionHardeningTest.php
@@ -27,8 +27,8 @@ class InstallerSkipPermissionHardeningTest extends InstallerTestBase {
*/
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 ' . $this->siteDirectory . ' and ' . $this->siteDirectory . '/settings.php 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 online handbook.');
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php
index 570354028cf..b3ad2445292 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php
@@ -95,8 +95,8 @@ class InstallerTest extends InstallerTestBase {
// 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 c7b5769e4c8..f9c899e5b36 100644
--- a/core/tests/Drupal/Tests/Core/Image/ImageTest.php
+++ b/core/tests/Drupal/Tests/Core/Image/ImageTest.php
@@ -188,7 +188,7 @@ class ImageTest extends UnitTestCase {
public function testIsValid() {
$this->getTestImage(FALSE);
$this->assertTrue($this->image->isValid());
- $this->assertTrue(is_readable($this->image->getSource()));
+ $this->assertFileIsReadable($this->image->getSource());
}
/**