예제 #1
0
 /**
  * Create service
  *
  * @param  ServiceLocatorInterface $serviceLocator
  * @return WriterPluginManager
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('Config');
     if (!isset($config[self::OPTIONS_KEY])) {
         $config[self::OPTIONS_KEY] = [];
     }
     $managerOptions = new Config($config[self::OPTIONS_KEY]);
     $writerManager = new WriterPluginManager($managerOptions);
     $writerManager->setServiceLocator($serviceLocator);
     return $writerManager;
 }
 /**
  * @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 testInvokableClassFirephp()
 {
     $firephp = $this->plugins->get('firephp');
     $this->assertInstanceOf('Zend\\Log\\Writer\\Firephp', $firephp);
 }