brianium/paratest — pull request #23 by dbaltas (2013-02-05 11:41:29+00:00)
Title: Features/ Uniquely identify concurrent processes

Allows phpunit to run with an extra environment variable, TEST_TOKEN
which is unique per running process.

Paratest attaches the TEST_TOKEN environment variable to the command.
```
TEST_TOKEN=1 phpunit file1
TEST_TOKEN=2 phpunit file2
TEST_TOKEN=3 phpunit file3
```

When a running process ends, the token is released to be acquired by the next process to run.

The test suite can use the value of the variable to ensure a unique resource (database, file system) for parallel processes .
In the application code (TestBootstrap)
```php
$testToken = getenv('TEST_TOKEN');
if (is_numeric($testToken)) {
$databaseName .= sprintf("%s", (int)$testToken+1);
}
```