[Process] Fix broken tests for PHP 7.2

This commit is contained in:
Samuel ROZE 2017-10-11 13:06:43 +01:00 committed by Nicolas Grekas
parent 682cdc3db0
commit b410a3662c
2 changed files with 22 additions and 3 deletions

View File

@ -16,15 +16,16 @@ addons:
env:
global:
- MIN_PHP=7.1.3
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/versions/7.1/bin/php
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/shims/php
matrix:
include:
- php: 7.1.3
- php: 7.1
env: deps=high
- php: 7.1
- php: 7.2
env: deps=low
fast_finish: true
cache:

View File

@ -117,9 +117,14 @@ class ProcessTest extends TestCase
$p = $this->getProcess(array(self::$phpBin, __DIR__.'/NonStopableProcess.php', 30));
$p->start();
while (false === strpos($p->getOutput(), 'received')) {
while ($p->isRunning() && false === strpos($p->getOutput(), 'received')) {
usleep(1000);
}
if (!$p->isRunning()) {
throw new \LogicException('Process is not running: '.$p->getErrorOutput());
}
$start = microtime(true);
$p->stop(0.1);
@ -1456,6 +1461,19 @@ Array
)
EOTXT;
if (\PHP_VERSION_ID >= 70200) {
$expected = <<<EOTXT
Array
(
[0] => Standard input code
[1] => a
[2] =>
[3] => b
)
EOTXT;
}
$this->assertSame($expected, $p->getOutput());
}