You are here

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

File

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

Class

QuestionHelperTest
@group tty

Namespace

Symfony\Component\Console\Tests\Helper

Code

public function testAsk() {
  $dialog = new QuestionHelper();
  $dialog
    ->setInputStream($this
    ->getInputStream("\n8AM\n"));
  $question = new Question('What time is it?', '2PM');
  $this
    ->assertEquals('2PM', $dialog
    ->ask($this
    ->createInputInterfaceMock(), $this
    ->createOutputInterface(), $question));
  $question = new Question('What time is it?', '2PM');
  $this
    ->assertEquals('8AM', $dialog
    ->ask($this
    ->createInputInterfaceMock(), $output = $this
    ->createOutputInterface(), $question));
  rewind($output
    ->getStream());
  $this
    ->assertEquals('What time is it?', stream_get_contents($output
    ->getStream()));
}