function BrowserTestBase::filePreDeleteCallback

Same name in other branches
  1. 9 core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::filePreDeleteCallback()
  2. 8.9.x core/tests/Drupal/Tests/BrowserTestBase.php \Drupal\Tests\BrowserTestBase::filePreDeleteCallback()
  3. 10 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()

1 call to BrowserTestBase::filePreDeleteCallback()
RecipeQuickStartTest::tearDown in core/tests/Drupal/Tests/Core/Recipe/RecipeQuickStartTest.php

File

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.