public function testExecute() { $formatter = new CommandLineFormatter('%msg%'); $record = array('extra' => array()); $stub = $this->getMockForAbstractClass('Itkg\\Core\\Command\\CommandExecuterAbstract', array('name', $formatter, $record)); $exception = new \Exception('My exception'); $stub->expects($this->any())->method('doExecute')->will($this->throwException($exception)); $output = new Output(); $stub->execute(new ArgvInput(), $output); $this->assertEquals($formatter->formatException($exception, $record) . PHP_EOL, $output->output); }
/** * Write an exception with extra record params * * @param \Exception $exception * @param array $record */ protected function writeException(\Exception $exception, array $record = array()) { $record = array_merge($this->defautlRecord, $record); $this->output->writeln($this->formatter->formatException($exception, $record)); }