You are here

public static function TestDatabase::releaseAllTestLocks in Drupal 9

Same name and namespace in other branches
  1. 8 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 155

Class

TestDatabase
Provides helper methods for interacting with the fixture database.

Namespace

Drupal\Core\Test

Code

public static function releaseAllTestLocks() {
  $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);
    }
  }
}