diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php index fe25f95109c..f4a23e7c1d8 100644 --- a/core/modules/simpletest/src/TestBase.php +++ b/core/modules/simpletest/src/TestBase.php @@ -1532,7 +1532,11 @@ abstract class TestBase { * need to get deleted too. */ public static function filePreDeleteCallback($path) { - chmod($path, 0700); + // When the webserver runs with the same system user as the test runner, we + // can make read-only files writable again. If not, chmod will fail while + // the file deletion still works if file permissions have been configured + // correctly. Thus, we ignore any problems while running chmod. + @chmod($path, 0700); } /** diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index 5dfa68a6895..e91c3469d22 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -557,10 +557,11 @@ abstract class BrowserTestBase extends \PHPUnit_Framework_TestCase { * The file path. */ public static function filePreDeleteCallback($path) { - $success = @chmod($path, 0700); - if (!$success) { - trigger_error("Can not make $path writable whilst cleaning up test directory. The webserver and phpunit are probably not being run by the same user."); - } + // When the webserver runs with the same system user as phpunit, we can + // make read-only files writable again. If not, chmod will fail while the + // file deletion still works if file permissions have been configured + // correctly. Thus, we ignore any problems while running chmod. + @chmod($path, 0700); } /**