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

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