You are here

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

@expectedException \InvalidArgumentException @expectedExceptionMessage The provided answer is ambiguous. Value should be one of env_2 or env_3.

File

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

Class

QuestionHelperTest
@group tty

Namespace

Symfony\Component\Console\Tests\Helper

Code

public function testAmbiguousChoiceFromChoicelist() {
  $possibleChoices = array(
    'env_1' => 'My first environment',
    'env_2' => 'My environment',
    'env_3' => 'My environment',
  );
  $dialog = new QuestionHelper();
  $dialog
    ->setInputStream($this
    ->getInputStream("My environment\n"));
  $helperSet = new HelperSet(array(
    new FormatterHelper(),
  ));
  $dialog
    ->setHelperSet($helperSet);
  $question = new ChoiceQuestion('Please select the environment to load', $possibleChoices);
  $question
    ->setMaxAttempts(1);
  $dialog
    ->ask($this
    ->createInputInterfaceMock(), $this
    ->createOutputInterface(), $question);
}