/**
* @group tty
*/
class QuestionHelperTest extends AbstractQuestionHelperTestCase
{ public function testAskChoice() { $questionHelper =
new QuestionHelper();
$helperSet =
new HelperSet([new FormatterHelper()]);
$questionHelper->
setHelperSet($helperSet);
$heroes =
['Superman', 'Batman', 'Spiderman'
];
$inputStream =
$this->
getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"
);
$question =
new ChoiceQuestion('What is your favorite superhero?',
$heroes, '2'
);
$question->
setMaxAttempts(1
);
// first answer is an empty answer, we're supposed to receive the default value
$this->
assertEquals('Spiderman',
$questionHelper->
ask($this->
createStreamableInputInterfaceMock($inputStream),
$this->
createOutputInterface(),
$question));
$question =
new ChoiceQuestion('What is your favorite superhero?',
$heroes);