Skip to content

[Process] Fix broken tests for PHP 7.2 #24516

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could add without deps=low too

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope: the matrix is optimized to test the maximum of cases with the minimum number of jobs

env: deps=low

fast_finish: true

cache:
Expand Down
20 changes: 19 additions & 1 deletion src/Symfony/Component/Process/Tests/ProcessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,14 @@ public function testStopWithTimeoutIsActuallyWorking()
$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);

Expand Down Expand Up @@ -1456,6 +1461,19 @@ public function testRawCommandLine()
)

EOTXT;

if (\PHP_VERSION_ID >= 70200) {
$expected = <<<EOTXT
Array
(
[0] => Standard input code
[1] => a
[2] =>
[3] => b
)

EOTXT;
}
$this->assertSame($expected, $p->getOutput());
}

Expand Down