/** * @covers Robo47_Log_Writer_DoctrineTable::factory * @covers Robo47_Log_Writer_Exception */ public function testFactoryWithoutTableThrowsException() { $config = array(); try { $writer = Robo47_Log_Writer_DoctrineTable::factory($config); $this->fail('No Exception thrown'); } catch (Robo47_Log_Writer_Exception $e) { $this->assertEquals('No table defined for Robo47_Log_Writer_DoctrineTable', $e->getMessage(), 'Wrong Exception message'); } }
/** * Construct a Zend_Log driver * * @param array|Zend_Config $config * @return Robo47_Log_Writer_DoctrineTable */ public static function factory($config) { if ($config instanceof Zend_Config) { $config = $config->toArray(); } if (!isset($config['table'])) { $message = 'No table defined for Robo47_Log_Writer_DoctrineTable'; throw new Robo47_Log_Writer_Exception($message); } $writer = new Robo47_Log_Writer_DoctrineTable($config['table']); if (isset($config['columnMap'])) { $writer->setColumnMap($config['columnMap']); } return $writer; }