public function AbstractProcessTest::testGetEmptyIncrementalErrorOutput in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/process/Tests/AbstractProcessTest.php \Symfony\Component\Process\Tests\AbstractProcessTest::testGetEmptyIncrementalErrorOutput()
File
- vendor/
symfony/ process/ Tests/ AbstractProcessTest.php, line 339
Class
- AbstractProcessTest
- @author Robert Schönthal <seroscho@googlemail.com>
Namespace
Symfony\Component\Process\TestsCode
public function testGetEmptyIncrementalErrorOutput() {
// use a lock file to toggle between writing ("W") and reading ("R") the
// output 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();
$shouldWrite = false;
while ($p
->isRunning()) {
if ('R' === file_get_contents($lock)) {
if (!$shouldWrite) {
$this
->assertLessThanOrEqual(1, preg_match_all('/ERROR/', $p
->getIncrementalOutput(), $matches));
$shouldWrite = true;
}
else {
$this
->assertSame('', $p
->getIncrementalOutput());
file_put_contents($lock, 'W');
$shouldWrite = false;
}
}
usleep(100);
}
unlink($lock);
}