1
0
Fork 0

make clashes less likely and use silencer

pull/4834/head
Rob Bast 2016-01-26 14:03:08 +01:00
parent 1818b95149
commit f1fd7d1dd6
1 changed files with 4 additions and 2 deletions

View File

@ -16,6 +16,7 @@ use Composer\Semver\VersionParser;
use Composer\Package\AliasPackage;
use Composer\Semver\Constraint\Constraint;
use Composer\Util\Filesystem;
use Composer\Util\Silencer;
abstract class TestCase extends \PHPUnit_Framework_TestCase
{
@ -62,8 +63,9 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
$root = sys_get_temp_dir();
do {
$unique = $root . DIRECTORY_SEPARATOR . uniqid('composer-test-');
if (!file_exists($unique) && false !== @mkdir($unique, 0777)) {
$unique = $root . DIRECTORY_SEPARATOR . uniqid('composer-test-' . rand(1000, 9000));
if (!file_exists($unique) && Silencer::call('mkdir', $unique, 0777)) {
return realpath($unique);
}
} while (--$attempts);