public checkTimeout ( ) |
public function checkTimeout()
{
if ($this->status !== self::STATUS_STARTED) {
return;
}
if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
$this->stop(0);
throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
}
if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
$this->stop(0);
throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
}
}
/** * Check if process is not running longer then specified timeout, return error message if so. * @param Process $process Process instance * @param string $testClass Name of tested class * @return string|null Error message if process timeout exceeded */ protected function checkProcessTimeout(Process $process, $testClass) { try { $process->checkTimeout(); } catch (ProcessTimedOutException $e) { return sprintf('[%s]: Process for class "%s" exceeded the time out of %d seconds and was killed.', date("Y-m-d H:i:s"), $testClass, $e->getExceededTimeout()); } }