public function testStopWithTimeoutIsActuallyWorking() {
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$this
->markTestSkipped('Stop with timeout does not work on windows, it requires posix signals');
}
// exec is mandatory here since we send a signal to the process
// see https://github.com/symfony/symfony/issues/5030 about prepending
// command with exec
$p = $this
->getProcess('exec php ' . __DIR__ . '/NonStopableProcess.php 3');
$p
->start();
usleep(100000);
$start = microtime(true);
$p
->stop(1.1, SIGKILL);
while ($p
->isRunning()) {
usleep(1000);
}
$duration = microtime(true) - $start;
$this
->assertLessThan(1.3, $duration);
}