function FixturesBase::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.

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

File

core/tests/Drupal/Tests/Composer/Plugin/FixturesBase.php, line 165

Class

FixturesBase
Base class for fixtures to test composer plugins.

Namespace

Drupal\Tests\Composer\Plugin

Code

protected static function persistentPrefix() : string {
    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.