Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c192a0c

Browse filesBrowse files
committed
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 | #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 ------- 474f3be [Console] Fix SymfonyQuestionHelper tests sometimes failing on AppVeyor
2 parents 416f0ab + 474f3be commit c192a0c
Copy full SHA for c192a0c

File tree

1 file changed

+10
-5
lines changed
Filter options

1 file changed

+10
-5
lines changed

‎src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Helper/SymfonyQuestionHelperTest.php
+10-5Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,13 @@ public function testChoiceQuestionPadding()
145145
);
146146

147147
$this->assertOutputContains(<<<EOT
148-
qqq:
148+
qqq:
149149
[foo ] foo
150150
[żółw ] bar
151151
[łabądź] baz
152152
>
153153
EOT
154-
, $output);
154+
, $output, true);
155155
}
156156

157157
public function testChoiceQuestionCustomPrompt()
@@ -168,9 +168,9 @@ public function testChoiceQuestionCustomPrompt()
168168
$this->assertOutputContains(<<<EOT
169169
qqq:
170170
[0] foo
171-
>ccc>
171+
>ccc>
172172
EOT
173-
, $output);
173+
, $output, true);
174174
}
175175

176176
protected function getInputStream($input)
@@ -200,10 +200,15 @@ protected function createInputInterfaceMock($interactive = true)
200200
return $mock;
201201
}
202202

203-
private function assertOutputContains($expected, StreamOutput $output)
203+
private function assertOutputContains($expected, StreamOutput $output, $normalize = false)
204204
{
205205
rewind($output->getStream());
206206
$stream = stream_get_contents($output->getStream());
207+
208+
if ($normalize) {
209+
$stream = str_replace(PHP_EOL, "\n", $stream);
210+
}
211+
207212
$this->assertStringContainsString($expected, $stream);
208213
}
209214
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.