Skip to content

Commit c1e2bb5

Browse files
committed
minor #6644 [Console] Fix wrong quotes in QuestionHelper::setInputStream() (chalasr)
This PR was merged into the 2.7 branch. Discussion ---------- [Console] Fix wrong quotes in QuestionHelper::setInputStream() As pointed by [this Stack Overflow question](http://stackoverflow.com/questions/37709966/symfony-interactive-command-test-ends-with-runtimeexception/37712073), the code example showing how to test a command that interacts with the user is wrong. The reason is that `\n` between simple quotes are [not considered as break lines](http://stackoverflow.com/questions/2531969/print-newline-in-php-in-single-quotes) in PHP, even escaped with an additional `\`. Commits ------- 5679e2d Fix wrong quotes in QuestionHelper::setInputStream()
2 parents 1fa6aab + 5679e2d commit c1e2bb5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/console/helpers/questionhelper.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ from the command line, you need to set the helper input stream::
294294
$commandTester = new CommandTester($command);
295295

296296
$helper = $command->getHelper('question');
297-
$helper->setInputStream($this->getInputStream('Test\\n'));
297+
$helper->setInputStream($this->getInputStream("Test\n"));
298298
// Equals to a user inputting "Test" and hitting ENTER
299299
// If you need to enter a confirmation, "yes\n" will work
300300

0 commit comments

Comments
 (0)