public function AbstractProcessTest::testGetIncrementalErrorOutput in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/process/Tests/AbstractProcessTest.php \Symfony\Component\Process\Tests\AbstractProcessTest::testGetIncrementalErrorOutput()
File
- vendor/
symfony/ process/ Tests/ AbstractProcessTest.php, line 309
Class
- AbstractProcessTest
- @author Robert Schönthal <seroscho@googlemail.com>
Namespace
Symfony\Component\Process\TestsCode
public function testGetIncrementalErrorOutput() {
// use a lock file to toggle between writing ("W") and reading ("R") the
// error stream
$lock = tempnam(sys_get_temp_dir(), get_class($this) . 'Lock');
file_put_contents($lock, 'W');
$p = $this
->getProcess(sprintf('%s -r %s', self::$phpBin, escapeshellarg('$n = 0; while ($n < 3) { if (\'W\' === file_get_contents(' . var_export($lock, true) . ')) { file_put_contents(\'php://stderr\', \'ERROR\'); $n++; file_put_contents(' . var_export($lock, true) . ', \'R\'); } usleep(100); }')));
$p
->start();
while ($p
->isRunning()) {
if ('R' === file_get_contents($lock)) {
$this
->assertLessThanOrEqual(1, preg_match_all('/ERROR/', $p
->getIncrementalErrorOutput(), $matches));
file_put_contents($lock, 'W');
}
usleep(100);
}
unlink($lock);
}