$tester = new ApplicationTester($application); $tester->run(array('command' => 'foo')); $t->is($tester->getDisplay(), file_get_contents($fixtures . '/application_renderexception1.txt'), '->renderException() renders a pretty exception'); $tester->run(array('command' => 'foo'), array('verbosity' => Output::VERBOSITY_VERBOSE)); $t->like($tester->getDisplay(), '/Exception trace/', '->renderException() renders a pretty exception with a stack trace when verbosity is verbose'); $tester->run(array('command' => 'list', '--foo' => true)); $t->is($tester->getDisplay(), file_get_contents($fixtures . '/application_renderexception2.txt'), '->renderException() renders the command synopsis when an exception occurs in the context of a command'); // ->run() $t->diag('->run()'); $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $application->addCommand($command = new Foo1Command()); $_SERVER['argv'] = array('cli.php', 'foo:bar1'); ob_start(); $application->run(); ob_end_clean(); $t->is(get_class($command->input), 'Symfony\\Components\\CLI\\Input\\ArgvInput', '->run() creates an ArgvInput by default if none is given'); $t->is(get_class($command->output), 'Symfony\\Components\\CLI\\Output\\ConsoleOutput', '->run() creates a ConsoleOutput by default if none is given'); $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $tester = new ApplicationTester($application); $tester->run(array()); $t->is($tester->getDisplay(), file_get_contents($fixtures . '/application_run1.txt'), '->run() runs the list command if no argument is passed'); $tester->run(array('--help' => true)); $t->is($tester->getDisplay(), file_get_contents($fixtures . '/application_run2.txt'), '->run() runs the help command if --help is passed'); $application = new Application(); $application->setAutoExit(false); $application->setCatchExceptions(false); $tester = new ApplicationTester($application);