You are here

protected static function Fixtures::persistentPrefix in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php \Drupal\Tests\Composer\Plugin\Scaffold\Fixtures::persistentPrefix()
  2. 10 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.

1 call to Fixtures::persistentPrefix()
Fixtures::tmpDir in core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php
Generates a path to a temporary location, but do not create the directory.

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