You are here

public static function BrowserTestBase::filePreDeleteCallback in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/BrowserTestBase.php \Drupal\simpletest\BrowserTestBase::filePreDeleteCallback()

Ensures test files are deletable within file_unmanaged_delete_recursive().

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.

File

core/modules/simpletest/src/BrowserTestBase.php, line 367
Contains \Drupal\simpletest\BrowserTestBase.

Class

BrowserTestBase
Provides a test case for functional Drupal tests.

Namespace

Drupal\simpletest

Code

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.");
  }
}