You are here

public function QuestionHelperTest::testSelectChoiceFromSimpleChoices in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Tests/Helper/QuestionHelperTest.php \Symfony\Component\Console\Tests\Helper\QuestionHelperTest::testSelectChoiceFromSimpleChoices()

@dataProvider simpleAnswerProvider

File

vendor/symfony/console/Tests/Helper/QuestionHelperTest.php, line 222

Class

QuestionHelperTest
@group tty

Namespace

Symfony\Component\Console\Tests\Helper

Code

public function testSelectChoiceFromSimpleChoices($providedAnswer, $expectedValue) {
  $possibleChoices = array(
    'My environment 1',
    'My environment 2',
    'My environment 3',
  );
  $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);
}