use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
use Symfony\Component\Console\Output\StreamOutput;
-use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Question\ChoiceQuestion;
+use Symfony\Component\Console\Question\Question;
/**
* @group tty
$this->assertOutputContains('What is your favorite superhero? [Superman, Batman]', $output);
}
+ public function testAskChoiceWithChoiceValueAsDefault()
+ {
+ $questionHelper = new SymfonyQuestionHelper();
+ $helperSet = new HelperSet(array(new FormatterHelper()));
+ $questionHelper->setHelperSet($helperSet);
+ $question = new ChoiceQuestion('What is your favorite superhero?', array('Superman', 'Batman', 'Spiderman'), 'Batman');
+ $question->setMaxAttempts(1);
+
+ $this->assertSame('Batman', $questionHelper->ask($this->createStreamableInputInterfaceMock($this->getInputStream("Batman\n")), $output = $this->createOutputInterface(), $question));
+ $this->assertOutputContains('What is your favorite superhero? [Batman]', $output);
+ }
+
public function testAskReturnsNullIfValidatorAllowsIt()
{
$questionHelper = new SymfonyQuestionHelper();