Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
make Application::bootstrap() ready for HttpMethodListener integration
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanotorresi committed Feb 23, 2015
1 parent 78f56cb commit ee3d114
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions library/Zend/Mvc/Service/ServiceListenerFactory.php
Expand Up @@ -57,6 +57,7 @@ class ServiceListenerFactory implements FactoryInterface
'FormAnnotationBuilder' => 'Zend\Mvc\Service\FormAnnotationBuilderFactory',
'FormElementManager' => 'Zend\Mvc\Service\FormElementManagerFactory',
'HttpRouter' => 'Zend\Mvc\Service\RouterFactory',
'HttpMethodListener' => 'Zend\Mvc\Service\HttpMethodListenerFactory',
'HttpViewManager' => 'Zend\Mvc\Service\HttpViewManagerFactory',
'HydratorManager' => 'Zend\Mvc\Service\HydratorManagerFactory',
'InjectTemplateListener' => 'Zend\Mvc\Service\InjectTemplateListenerFactory',
Expand Down
18 changes: 18 additions & 0 deletions tests/ZendTest/Mvc/ApplicationTest.php
Expand Up @@ -185,6 +185,24 @@ public function testBootstrapRegistersViewManagerAsBootstrapListener()
$this->assertSame(array($viewManager, 'onBootstrap'), $callback);
}

public function testBootstrapCanRegisterHttpMethodListener()
{
$httpMethodListener = $this->serviceManager->get('HttpMethodListener');
$this->application->bootstrap(array('HttpMethodListener'));
$events = $this->application->getEventManager();
$listeners = $events->getListeners(MvcEvent::EVENT_ROUTE);
$foundListener = false;
foreach($listeners as $listener) {
$callback = $listener->getCallback();
$foundListener = $callback === array($httpMethodListener, 'onRoute');
if ($foundListener) {
break;
}
}

$this->assertTrue($foundListener);
}

public function testBootstrapRegistersConfiguredMvcEvent()
{
$this->assertNull($this->application->getMvcEvent());
Expand Down

0 comments on commit ee3d114

Please sign in to comment.