Skip to content

Commit 0b83ea7

Browse files
committed
tests: removes temp dir after test
1 parent 38dca53 commit 0b83ea7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/bootstrap.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515

1616

1717
// create temporary directory
18-
define('TEMP_DIR', __DIR__ . '/tmp/' . getmypid());
19-
@mkdir(dirname(TEMP_DIR)); // @ - directory may already exist
20-
Tester\Helpers::purge(TEMP_DIR);
18+
define('TEMP_DIR', __DIR__ . '/tmp/' . lcg_value());
19+
@mkdir(TEMP_DIR, 0777, TRUE); // @ - base directory may already exist
20+
register_shutdown_function(function () {
21+
Tester\Helpers::purge(TEMP_DIR);
22+
rmdir(TEMP_DIR);
23+
});
2124

2225

2326
function test(\Closure $function)

0 commit comments

Comments
 (0)