You are here

public function LegacyDialogHelperTest::testAskConfirmation in Zircon Profile 8

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

File

vendor/symfony/console/Tests/Helper/LegacyDialogHelperTest.php, line 117

Class

LegacyDialogHelperTest
@group legacy

Namespace

Symfony\Component\Console\Tests\Helper

Code

public function testAskConfirmation() {
  $dialog = new DialogHelper();
  $dialog
    ->setInputStream($this
    ->getInputStream("\n\n"));
  $this
    ->assertTrue($dialog
    ->askConfirmation($this
    ->getOutputStream(), 'Do you like French fries?'));
  $this
    ->assertFalse($dialog
    ->askConfirmation($this
    ->getOutputStream(), 'Do you like French fries?', false));
  $dialog
    ->setInputStream($this
    ->getInputStream("y\nyes\n"));
  $this
    ->assertTrue($dialog
    ->askConfirmation($this
    ->getOutputStream(), 'Do you like French fries?', false));
  $this
    ->assertTrue($dialog
    ->askConfirmation($this
    ->getOutputStream(), 'Do you like French fries?', false));
  $dialog
    ->setInputStream($this
    ->getInputStream("n\nno\n"));
  $this
    ->assertFalse($dialog
    ->askConfirmation($this
    ->getOutputStream(), 'Do you like French fries?', true));
  $this
    ->assertFalse($dialog
    ->askConfirmation($this
    ->getOutputStream(), 'Do you like French fries?', true));
}