public function testShellTimeout() { $shell = new Shell(); $shell->setProcessLimit(1); $command1 = sprintf('%s -r %s', $this->phpExecutablePath, escapeshellarg('echo "Hello world!";')); $command2 = sprintf('%s -r %s', $this->phpExecutablePath, escapeshellarg('sleep(5);' . 'echo "Hello world!";')); $process1 = $shell->startProcess($command1); $process2 = $shell->startProcess($command2); try { $shell->wait(0.5); $this->fail('The expected exception was not thrown'); } catch (TimeoutException $e) { } $this->assertSame(FutureProcess::STATUS_EXITED, $process1->getStatus(false)); $this->assertSame('Hello world!', $process1->readFromPipe(1)); $this->assertSame(FutureProcess::STATUS_RUNNING, $process2->getStatus(false)); $process2->abort(); }