Exemple #1
0
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
$tester = new ApplicationTester($application);
$tester->run(array('--color' => true));
$t->ok($tester->getOutput()->isDecorated(), '->run() forces color output if --color is passed');
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
$tester = new ApplicationTester($application);
$tester->run(array('--version' => true));
$t->is($tester->getDisplay(), file_get_contents($fixtures . '/application_run4.txt'), '->run() displays the program version if --version is passed');
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
$tester = new ApplicationTester($application);
$tester->run(array('command' => 'list', '--quiet' => true));
$t->is($tester->getDisplay(), '', '->run() removes all output if --quiet is passed');
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
$tester = new ApplicationTester($application);
$tester->run(array('command' => 'list', '--verbose' => true));
$t->is($tester->getOutput()->getVerbosity(), Output::VERBOSITY_VERBOSE, '->run() sets the output to verbose is --verbose is passed');
$application = new Application();
$application->setAutoExit(false);
$application->setCatchExceptions(false);
$application->addCommand(new FooCommand());
$tester = new ApplicationTester($application);
$tester->run(array('command' => 'foo:bar', '--no-interaction' => true));
$t->is($tester->getDisplay(), "called\n", '->run() does not called interact() if --no-interaction is passed');