Skip to content

Commit

Permalink
zendframework#6266 - Verifying that the `EventManagerAwareInitializer…
Browse files Browse the repository at this point in the history
…` can be replaced
  • Loading branch information
Ocramius committed May 20, 2014
1 parent 4a456f9 commit af02bd4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/ZendTest/Mvc/Service/ServiceManagerConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,29 @@ public function testServiceLocatorInitializerCanBeReplaced()

$serviceManager->get('service-locator-aware');
}

/**
* @group 6266
*/
public function testEventManagerInitializerCanBeReplaced()
{
$instance = $this->getMock('Zend\EventManager\EventManagerAwareInterface');
$initializer = $this->getMock('stdClass', array('__invoke'));
$serviceManager = new ServiceManager(new ServiceManagerConfig(array(
'initializers' => array(
'EventManagerAwareInitializer' => $initializer
),
'factories' => array(
'event-manager-aware' => function () use ($instance) {
return $instance;
},
),
)));

$initializer->expects($this->once())->method('__invoke')->with($instance, $serviceManager);
$instance->expects($this->never())->method('getEventManager');
$instance->expects($this->never())->method('setEventManager');

$serviceManager->get('event-manager-aware');
}
}

0 comments on commit af02bd4

Please sign in to comment.