public function QuestionHelperTest::testSelectChoiceFromChoiceList in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Tests/Helper/QuestionHelperTest.php \Symfony\Component\Console\Tests\Helper\QuestionHelperTest::testSelectChoiceFromChoiceList()
@dataProvider answerProvider
File
- vendor/
symfony/ console/ Tests/ Helper/ QuestionHelperTest.php, line 293
Class
- QuestionHelperTest
- @group tty
Namespace
Symfony\Component\Console\Tests\HelperCode
public function testSelectChoiceFromChoiceList($providedAnswer, $expectedValue) {
$possibleChoices = array(
'env_1' => 'My environment 1',
'env_2' => 'My environment',
'env_3' => 'My environment',
);
$dialog = new QuestionHelper();
$dialog
->setInputStream($this
->getInputStream($providedAnswer . "\n"));
$helperSet = new HelperSet(array(
new FormatterHelper(),
));
$dialog
->setHelperSet($helperSet);
$question = new ChoiceQuestion('Please select the environment to load', $possibleChoices);
$question
->setMaxAttempts(1);
$answer = $dialog
->ask($this
->createInputInterfaceMock(), $this
->createOutputInterface(), $question);
$this
->assertSame($expectedValue, $answer);
}