Skip to content

Commit

Permalink
[zendframework#4455] Updated Logger abstract factory to reflect MVC
Browse files Browse the repository at this point in the history
- Use LogWriterManager and LogProcessorManager services instead.
- Added group annotations to tests
  • Loading branch information
weierophinney committed Mar 5, 2014
1 parent 8c2ece8 commit 00e24db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
8 changes: 4 additions & 4 deletions library/Zend/Log/LoggerAbstractServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ protected function processConfig(&$config, ServiceLocatorInterface $services)

if ((!isset($config['writer_plugin_manager'])
|| ! $config['writer_plugin_manager'] instanceof AbstractPluginManager)
&& $services->has('Zend\Log\WriterPluginManager')
&& $services->has('LogWriterManager')
) {
$config['writer_plugin_manager'] = $services->get('Zend\Log\WriterPluginManager');
$config['writer_plugin_manager'] = $services->get('LogWriterManager');
}

if (isset($config['processor_plugin_manager'])
Expand All @@ -114,9 +114,9 @@ protected function processConfig(&$config, ServiceLocatorInterface $services)

if ((!isset($config['processor_plugin_manager'])
|| ! $config['processor_plugin_manager'] instanceof AbstractPluginManager)
&& $services->has('Zend\Log\ProcessorPluginManager')
&& $services->has('LogProcessorManager')
) {
$config['processor_plugin_manager'] = $services->get('Zend\Log\ProcessorPluginManager');
$config['processor_plugin_manager'] = $services->get('LogProcessorManager');
}

if (!isset($config['writers'])) {
Expand Down
10 changes: 8 additions & 2 deletions tests/ZendTest/Log/LoggerAbstractServiceFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ public function testRetrievesDatabaseServiceFromServiceManagerWhenEncounteringDb
$this->assertAttributeSame($db, 'db', $writer);
}

/**
* @group 4455
*/
public function testWillInjectWriterPluginManagerIfAvailable()
{
$writers = new WriterPluginManager();
Expand All @@ -140,7 +143,7 @@ public function testWillInjectWriterPluginManagerIfAvailable()
$services = new ServiceManager(new ServiceManagerConfig(array(
'abstract_factories' => array('Zend\Log\LoggerAbstractServiceFactory'),
)));
$services->setService('Zend\Log\WriterPluginManager', $writers);
$services->setService('LogWriterManager', $writers);
$services->setService('Config', array(
'log' => array(
'Application\Frontend' => array(
Expand All @@ -156,6 +159,9 @@ public function testWillInjectWriterPluginManagerIfAvailable()
$this->assertSame($mockWriter, $writer);
}

/**
* @group 4455
*/
public function testWillInjectProcessorPluginManagerIfAvailable()
{
$processors = new ProcessorPluginManager();
Expand All @@ -165,7 +171,7 @@ public function testWillInjectProcessorPluginManagerIfAvailable()
$services = new ServiceManager(new ServiceManagerConfig(array(
'abstract_factories' => array('Zend\Log\LoggerAbstractServiceFactory'),
)));
$services->setService('Zend\Log\ProcessorPluginManager', $processors);
$services->setService('LogProcessorManager', $processors);
$services->setService('Config', array(
'log' => array(
'Application\Frontend' => array(
Expand Down

0 comments on commit 00e24db

Please sign in to comment.