make clashes less likely and use silencer
parent
1818b95149
commit
f1fd7d1dd6
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue