$question =
new ChoiceQuestion('What is your favorite superhero?',
$heroes, '0'
);
$this->
assertSame('Superman',
$questionHelper->
ask($this->
createStreamableInputInterfaceMock($inputStream, false
),
$this->
createOutputInterface(),
$question));
$question =
new ChoiceQuestion('What is your favorite superhero?',
$heroes, 'Batman'
);
$this->
assertSame('Batman',
$questionHelper->
ask($this->
createStreamableInputInterfaceMock($inputStream, false
),
$this->
createOutputInterface(),
$question));
$question =
new ChoiceQuestion('What is your favorite superhero?',
$heroes, null
);
$this->
assertNull($questionHelper->
ask($this->
createStreamableInputInterfaceMock($inputStream, false
),
$this->
createOutputInterface(),
$question));
$question =
new ChoiceQuestion('What is your favorite superhero?',
$heroes, '0'
);
$question->
setValidator(null
);
$this->
assertSame('Superman',
$questionHelper->
ask($this->
createStreamableInputInterfaceMock($inputStream, false
),
$this->
createOutputInterface(),
$question));
try { $question =
new ChoiceQuestion('What is your favorite superhero?',
$heroes, null
);
$questionHelper->
ask($this->
createStreamableInputInterfaceMock($inputStream, false
),
$this->
createOutputInterface(),
$question);
} catch (\InvalidArgumentException
$e) { $this->
assertSame('Value "" is invalid',
$e->
getMessage());
} $question =
new ChoiceQuestion('Who are your favorite superheros?',
$heroes, '0, 1'
);
$question->
setMultiselect(true
);