public function AbstractProcessTest::testRunProcessWithTimeout in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/process/Tests/AbstractProcessTest.php \Symfony\Component\Process\Tests\AbstractProcessTest::testRunProcessWithTimeout()
2 methods override AbstractProcessTest::testRunProcessWithTimeout()
- SigchildDisabledProcessTest::testRunProcessWithTimeout in vendor/
symfony/ process/ Tests/ SigchildDisabledProcessTest.php - SigchildEnabledProcessTest::testRunProcessWithTimeout in vendor/
symfony/ process/ Tests/ SigchildEnabledProcessTest.php
File
- vendor/
symfony/ process/ Tests/ AbstractProcessTest.php, line 773
Class
- AbstractProcessTest
- @author Robert Schönthal <seroscho@googlemail.com>
Namespace
Symfony\Component\Process\TestsCode
public function testRunProcessWithTimeout() {
$timeout = 0.5;
$process = $this
->getProcess(self::$phpBin . ' -r "usleep(600000);"');
$process
->setTimeout($timeout);
$start = microtime(true);
try {
$process
->run();
$this
->fail('A RuntimeException should have been raised');
} catch (RuntimeException $e) {
}
$duration = microtime(true) - $start;
if ('\\' === DIRECTORY_SEPARATOR) {
// Windows is a bit slower as it read file handles, then allow twice the precision
$maxDuration = $timeout + 2 * Process::TIMEOUT_PRECISION;
}
else {
$maxDuration = $timeout + Process::TIMEOUT_PRECISION;
}
$this
->assertLessThan($maxDuration, $duration);
}