Skip to content

Commit ed7db6f

Browse files
committed
minor #21357 [Console] Mention how to test a multiline question’s answer (MatTheCat)
This PR was submitted for the 7.3 branch but it was merged into the 6.4 branch instead. Discussion ---------- [Console] Mention how to test a multiline question’s answer symfony/symfony#61690 follow-up Commits ------- 4545c5a [Console] Mention how to test a multiline question’s answer
2 parents 8ba749f + 4545c5a commit ed7db6f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

components/console/helpers/questionhelper.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,14 @@ from the command line, you need to set the inputs that the command expects::
545545
// additional input saying "yes" will work
546546
$commandTester->setInputs(['yes']);
547547

548+
// Answers to multiline questions need to be suffixed by
549+
// an end-of-transmission control character
550+
$commandTester->setInputs([<<<INPUT
551+
First line
552+
Second line
553+
\x04
554+
INPUT]);
555+
548556
$commandTester->execute(['command' => $command->getName()]);
549557

550558
// $this->assertRegExp('/.../', $commandTester->getDisplay());

0 commit comments

Comments
 (0)