Inheritance: extends Symfony\Component\Console\Application
示例#1
0
 /**
  * @requires function posix_isatty
  */
 public function testCanCheckIfTerminalIsInteractive()
 {
     $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));
 }
 public function testSetRunCustomDefaultCommand()
 {
     $command = new \FooCommand();
     $application = new Application();
     $application->setAutoExit(false);
     $application->add($command);
     $application->setDefaultCommand($command->getName());
     $tester = new ApplicationTester($application);
     $tester->run(array());
     $this->assertEquals('interact called' . PHP_EOL . 'called' . PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command');
     $application = new CustomDefaultCommandApplication();
     $application->setAutoExit(false);
     $tester = new ApplicationTester($application);
     $tester->run(array());
     $this->assertEquals('interact called' . PHP_EOL . 'called' . PHP_EOL, $tester->getDisplay(), 'Application runs the default set command if different from \'list\' command');
 }