Skip to content

Commit

Permalink
Merge pull request #341 from pfrenssen/random-failure-dirname
Browse files Browse the repository at this point in the history
Avoid random failures due to collisions in random directory names
  • Loading branch information
pfrenssen committed Jan 6, 2017
2 parents dc99a60 + 7b94cf3 commit fab1034
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,10 @@ public static function cleanTestFolders()
*/
public function prepareTestFolders()
{
$dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'behat' . DIRECTORY_SEPARATOR .
md5((int) microtime(TRUE) * rand(0, 10000));
do {
$random_name = md5((int) microtime(true) * rand(0, 100000));
$dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'behat' . DIRECTORY_SEPARATOR . $random_name;
} while (is_dir($dir));

mkdir($dir . '/features/bootstrap/i18n', 0777, true);

Expand Down

0 comments on commit fab1034

Please sign in to comment.