You are here

public static function BrowserTestBase::filePreDeleteCallback in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::filePreDeleteCallback()
  2. 9 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::filePreDeleteCallback()

Ensures test files are deletable.

Some tests chmod generated files to be read only. During BrowserTestBase::cleanupEnvironment() and other cleanup operations, these files need to get deleted too.

Parameters

string $path: The file path.

See also

\Drupal\Core\File\FileSystemInterface::deleteRecursive()

File

core/tests/Drupal/Tests/BrowserTestBase.php, line 411

Class

BrowserTestBase
Provides a test case for functional Drupal tests.

Namespace

Drupal\Tests

Code

public static function filePreDeleteCallback($path) {

  // 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);
}