function TestDatabase::releaseAllTestLocks

Same name in other branches
  1. 9 core/lib/Drupal/Core/Test/TestDatabase.php \Drupal\Core\Test\TestDatabase::releaseAllTestLocks()
  2. 8.9.x core/lib/Drupal/Core/Test/TestDatabase.php \Drupal\Core\Test\TestDatabase::releaseAllTestLocks()
  3. 11.x core/lib/Drupal/Core/Test/TestDatabase.php \Drupal\Core\Test\TestDatabase::releaseAllTestLocks()

Releases all test locks.

This should only be called once all the test fixtures have been cleaned up.

1 call to TestDatabase::releaseAllTestLocks()
TestSiteReleaseLocksCommand::execute in core/tests/Drupal/TestSite/Commands/TestSiteReleaseLocksCommand.php

File

core/lib/Drupal/Core/Test/TestDatabase.php, line 124

Class

TestDatabase
Provides helper methods for interacting with the fixture database.

Namespace

Drupal\Core\Test

Code

public static function releaseAllTestLocks() : void {
    $tmp = FileSystem::getOsTemporaryDirectory();
    $dir = dir($tmp);
    while (($entry = $dir->read()) !== FALSE) {
        if ($entry === '.' || $entry === '..') {
            continue;
        }
        $entry_path = $tmp . '/' . $entry;
        if (preg_match('/^test_\\d+/', $entry) && is_link($entry_path)) {
            unlink($entry_path);
        }
    }
}

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