Skip to content

Commit ba3b177

Browse files
minor #24516 [Process] Fix broken tests for PHP 7.2 (sroze)
This PR was squashed before being merged into the 4.0-dev branch (closes #24516). Discussion ---------- [Process] Fix broken tests for PHP 7.2 | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | no | Fixed tickets | #24524, #24515 | License | MIT | Doc PR | ø Following #24515, trying to fix Process tests with PHP 7.2 Commits ------- b410a36 [Process] Fix broken tests for PHP 7.2
2 parents 682cdc3 + b410a36 commit ba3b177

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

.travis.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ addons:
1616
env:
1717
global:
1818
- MIN_PHP=7.1.3
19-
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/versions/7.1/bin/php
19+
- SYMFONY_PROCESS_PHP_TEST_BINARY=~/.phpenv/shims/php
2020

2121
matrix:
2222
include:
2323
- php: 7.1.3
2424
- php: 7.1
2525
env: deps=high
26-
- php: 7.1
26+
- php: 7.2
2727
env: deps=low
28+
2829
fast_finish: true
2930

3031
cache:

src/Symfony/Component/Process/Tests/ProcessTest.php

+19-1
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,14 @@ public function testStopWithTimeoutIsActuallyWorking()
117117
$p = $this->getProcess(array(self::$phpBin, __DIR__.'/NonStopableProcess.php', 30));
118118
$p->start();
119119

120-
while (false === strpos($p->getOutput(), 'received')) {
120+
while ($p->isRunning() && false === strpos($p->getOutput(), 'received')) {
121121
usleep(1000);
122122
}
123+
124+
if (!$p->isRunning()) {
125+
throw new \LogicException('Process is not running: '.$p->getErrorOutput());
126+
}
127+
123128
$start = microtime(true);
124129
$p->stop(0.1);
125130

@@ -1456,6 +1461,19 @@ public function testRawCommandLine()
14561461
)
14571462
14581463
EOTXT;
1464+
1465+
if (\PHP_VERSION_ID >= 70200) {
1466+
$expected = <<<EOTXT
1467+
Array
1468+
(
1469+
[0] => Standard input code
1470+
[1] => a
1471+
[2] =>
1472+
[3] => b
1473+
)
1474+
1475+
EOTXT;
1476+
}
14591477
$this->assertSame($expected, $p->getOutput());
14601478
}
14611479

0 commit comments

Comments
 (0)