You are here

public function ApplicationTest::testCanCheckIfTerminalIsInteractive in Zircon Profile 8

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

File

vendor/symfony/console/Tests/ApplicationTest.php, line 1005

Class

ApplicationTest

Namespace

Symfony\Component\Console\Tests

Code

public function testCanCheckIfTerminalIsInteractive() {
  if (!function_exists('posix_isatty')) {
    $this
      ->markTestSkipped('posix_isatty function is required');
  }
  $application = new CustomDefaultCommandApplication();
  $application
    ->setAutoExit(false);
  $tester = new ApplicationTester($application);
  $tester
    ->run(array(
    'command' => 'help',
  ));
  $this
    ->assertFalse($tester
    ->getInput()
    ->hasParameterOption(array(
    '--no-interaction',
    '-n',
  )));
  $inputStream = $application
    ->getHelperSet()
    ->get('question')
    ->getInputStream();
  $this
    ->assertEquals($tester
    ->getInput()
    ->isInteractive(), @posix_isatty($inputStream));
}