Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #19097 [Console] Test SymfonyStyle::ask() output (chalasr)
This PR was merged into the 3.2-dev branch. Discussion ---------- [Console] Test SymfonyStyle::ask() output | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ Now that we can test an interactive command that uses SymfonyStyle (after #18999), we should test their output. Commits ------- e870758 [Console] Test SymfonyStyle::ask() output
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...ony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/command/interactive_command_1.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength; | ||
|
||
//Ensure that questions have the expected outputs | ||
return function (InputInterface $input, OutputInterface $output) { | ||
$output = new SymfonyStyleWithForcedLineLength($input, $output); | ||
$stream = fopen('php://memory', 'r+', false); | ||
|
||
fputs($stream, "Foo\nBar\nBaz"); | ||
rewind($stream); | ||
$input->setStream($stream); | ||
|
||
$output->ask('What\'s your name?'); | ||
$output->ask('How are you?'); | ||
$output->ask('Where do you come from?'); | ||
}; |
7 changes: 7 additions & 0 deletions
7
...mfony/Component/Console/Tests/Fixtures/Style/SymfonyStyle/output/interactive_output_1.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
What's your name?: | ||
> | ||
How are you?: | ||
> | ||
Where do you come from?: | ||
> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters