Skip to content

Commit 1bfad45

Browse files
[HttpClient] fix issues in tests
1 parent 9dcbd92 commit 1bfad45

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Test/TestHttpServer.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,23 @@
1919
*/
2020
class TestHttpServer
2121
{
22-
private static $started;
22+
private static $process;
2323

2424
public static function start()
2525
{
26-
if (self::$started) {
27-
return;
26+
if (self::$process) {
27+
self::$process->stop();
2828
}
2929

3030
$finder = new PhpExecutableFinder();
3131
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:8057']));
3232
$process->setWorkingDirectory(__DIR__.'/Fixtures/web');
3333
$process->start();
3434

35-
register_shutdown_function([$process, 'stop']);
36-
sleep('\\' === \DIRECTORY_SEPARATOR ? 10 : 1);
35+
do {
36+
usleep(50000);
37+
} while (!@fopen('http://127.0.0.1:8057/', 'r'));
3738

38-
self::$started = true;
39+
self::$process = $process;
3940
}
4041
}

0 commit comments

Comments
 (0)