You are here

public function QuestionHelperTest::testChoiceFromChoicelistWithMixedKeys 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::testChoiceFromChoicelistWithMixedKeys()

@dataProvider mixedKeysChoiceListAnswerProvider

File

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

Class

QuestionHelperTest
@group tty

Namespace

Symfony\Component\Console\Tests\Helper

Code

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