minor #35288 [Console] Fix SymfonyQuestionHelper tests sometimes failing on AppVeyor (fancyweb)
This PR was merged into the 3.4 branch.
Discussion
----------
[Console] Fix SymfonyQuestionHelper tests sometimes failing on AppVeyor
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | https://github.com/symfony/symfony/issues/35035
| License | MIT
| Doc PR | -
The test uses heredoc for the expected part. Expected line returns are `"\n"` because that's how they are written in the source code file.
However, on Windows, the console outputs `"\r\n"` (`PHP_EOL`) for new lines.
`"qqq:\r\n"` does not contain `"qqq:\n"`.
I'm still wondering why this test is not *always* failing...
Commits
-------
474f3bef08
[Console] Fix SymfonyQuestionHelper tests sometimes failing on AppVeyor
This commit is contained in:
commit
c192a0c2fb
@ -151,7 +151,7 @@ qqq:
|
||||
[łabądź] baz
|
||||
>
|
||||
EOT
|
||||
, $output);
|
||||
, $output, true);
|
||||
}
|
||||
|
||||
public function testChoiceQuestionCustomPrompt()
|
||||
@ -170,7 +170,7 @@ EOT
|
||||
[0] foo
|
||||
>ccc>
|
||||
EOT
|
||||
, $output);
|
||||
, $output, true);
|
||||
}
|
||||
|
||||
protected function getInputStream($input)
|
||||
@ -200,10 +200,15 @@ EOT
|
||||
return $mock;
|
||||
}
|
||||
|
||||
private function assertOutputContains($expected, StreamOutput $output)
|
||||
private function assertOutputContains($expected, StreamOutput $output, $normalize = false)
|
||||
{
|
||||
rewind($output->getStream());
|
||||
$stream = stream_get_contents($output->getStream());
|
||||
|
||||
if ($normalize) {
|
||||
$stream = str_replace(PHP_EOL, "\n", $stream);
|
||||
}
|
||||
|
||||
$this->assertStringContainsString($expected, $stream);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user