Skip to content

Commit dbf87d0

Browse files
trying to solve github action issue
1 parent 6e2052d commit dbf87d0

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/helpers/FileCacheTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,18 @@ public function testLockingMechanism(): void
112112
{
113113
$key = 'test_lock_key';
114114
$this->assertTrue($this->cache->delete($key));
115-
115+
116+
$descriptorspec = array(
117+
0 => array("pipe", "r"),
118+
1 => array("pipe", "w"),
119+
);
120+
116121
$t = microtime(true);
117122
// run another script in background
118-
exec('php ' . __DIR__ . '/lock.php > /dev/null 2>&1 &');
123+
$proc = proc_open('php ' . __DIR__ . DIRECTORY_SEPARATOR . 'lock.php', $descriptorspec, $pipes);
124+
// wait to make sure another script is running and it locked the key
125+
sleep(1);
126+
proc_close($proc);
119127

120128
if ($this->cache->lock($key)) {
121129
$this->assertGreaterThan(3.0, microtime(true) - $t);

0 commit comments

Comments
 (0)