public function testConstructor() { $output = new ConsoleOutput(Output::VERBOSITY_QUIET, true); $this->assertEquals(Output::VERBOSITY_QUIET, $output->getVerbosity(), '__construct() takes the verbosity as its first argument'); $this->assertSame($output->getFormatter(), $output->getErrorOutput()->getFormatter(), '__construct() takes a formatter or null as the third argument'); }
/** * @param InputInterface $input [optional] * @param OutputInterface $output [optional] * * @return int */ public function run(InputInterface $input = null, OutputInterface $output = null) { if (null === $input) { $input = new ArgvInput(); } if (null === $output) { $output = new ConsoleOutput(); } $this->_addOutputStyles($output); if ($output instanceof ConsoleOutput) { $this->_addOutputStyles($output->getErrorOutput()); } $this->configureIO($input, $output); try { $this->init(array(), $input, $output); } catch (Exception $e) { $output = new ConsoleOutput(); $this->renderException($e, $output->getErrorOutput()); } $return = parent::run($input, $output); // Fix for no return values -> used in interactive shell to prevent error output if ($return === null) { return 0; } return $return; }