File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff 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 );
You can’t perform that action at this time.
0 commit comments