You are here

protected static function Fixtures::persistentPrefix in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php \Drupal\Tests\Composer\Plugin\Scaffold\Fixtures::persistentPrefix()
  2. 9 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php \Drupal\Tests\Composer\Plugin\Scaffold\Fixtures::persistentPrefix()

Generates a persistent prefix to use with all of our temporary directories.

The presumption is that this should reduce collisions in highly-parallel tests. We prepend the process id to play nicely with phpunit process isolation.

Return value

string A random string that will remain the same for the entire process run.

File

core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php, line 270

Class

Fixtures
Convenience class for creating fixtures.

Namespace

Drupal\Tests\Composer\Plugin\Scaffold

Code

protected static function persistentPrefix() {
  if (empty(static::$randomPrefix)) {
    static::$randomPrefix = getmypid() . md5(microtime());
  }
  return static::$randomPrefix;
}