/** * @group 4455 */ public function testWillInjectWriterPluginManagerIfAvailable() { $writers = new WriterPluginManager(); $mockWriter = $this->getMock('Zend\\Log\\Writer\\WriterInterface'); $writers->setService('CustomWriter', $mockWriter); $services = new ServiceManager(new ServiceManagerConfig(array('abstract_factories' => array('Zend\\Log\\LoggerAbstractServiceFactory')))); $services->setService('LogWriterManager', $writers); $services->setService('Config', array('log' => array('Application\\Frontend' => array('writers' => array(array('name' => 'CustomWriter')))))); $log = $services->get('Application\\Frontend'); $logWriters = $log->getWriters(); $this->assertEquals(1, count($logWriters)); $writer = $logWriters->current(); $this->assertSame($mockWriter, $writer); }
public function testRegisteringInvalidWriterRaisesException() { $this->setExpectedException('Zend\\Log\\Exception\\InvalidArgumentException', 'must implement'); $this->plugins->setService('test', $this); }