We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c5a2dc8 commit da4f888Copy full SHA for da4f888
tests/bootstrap.php
@@ -17,9 +17,20 @@
17
18
19
// create temporary directory
20
-define('TEMP_DIR', __DIR__ . '/tmp/' . getmypid());
21
-@mkdir(dirname(TEMP_DIR)); // @ - directory may already exist
22
-Tester\Helpers::purge(TEMP_DIR);
+(function () {
+ define('TEMP_DIR', __DIR__ . '/tmp/' . getmypid());
+
23
+ // garbage collector
24
+ $GLOBALS['\\lock'] = $lock = fopen(__DIR__ . '/lock', 'w');
25
+ if (rand(0, 100)) {
26
+ flock($lock, LOCK_SH);
27
+ @mkdir(dirname(TEMP_DIR));
28
+ } elseif (flock($lock, LOCK_EX)) {
29
+ Tester\Helpers::purge(dirname(TEMP_DIR));
30
+ }
31
32
+ @mkdir(TEMP_DIR);
33
+})();
34
35
36
function test(\Closure $function): void
0 commit comments