Ejemplo n.º 1
0
 protected function getEventWithEventManager()
 {
     $mockEventManager = \Mockery::mock('\\Zend\\EventManager');
     $mockApplication = \Mockery::mock('\\Zend\\Mvc\\Application');
     $mockApplication->shouldReceive('getEventManager')->andReturn($mockEventManager);
     $event = new \Zend\Mvc\MvcEvent();
     $event->setApplication($mockApplication);
     return [$mockEventManager, $event];
 }
Ejemplo n.º 2
0
 public function testOnBootstrapListenersWithConsoleRequest()
 {
     $module = new Module();
     $application = $this->createApplication();
     $sm = $application->getServiceManager();
     $sm->setAllowOverride(true);
     $sm->setService('Request', new ConsoleRequest());
     $em = $application->getEventManager();
     $event = new \Zend\Mvc\MvcEvent();
     $event->setApplication($application);
     $this->assertCount(0, $em->getListeners(\Zend\Mvc\MvcEvent::EVENT_DISPATCH));
     $module->onBootstrap($event);
     $this->assertCount(0, $em->getListeners(\Zend\Mvc\MvcEvent::EVENT_DISPATCH));
 }
Ejemplo n.º 3
0
 public function getServiceConfig()
 {
     return array('factories' => array('MaglLegacyApplicationOptions' => function ($sl) {
         $config = $sl->get('Config');
         $options = $config['magl_legacy_application'];
         return new Options\LegacyControllerOptions($options);
     }, 'MaglControllerService' => function (ServiceManager $sl) {
         $eventManager = $sl->get('Application')->getEventManager();
         $event = new \Zend\Mvc\MvcEvent();
         $event->setApplication($sl->get('Application'));
         $event->setTarget($sl->get('Application'));
         $event->setRequest($sl->get('Request'));
         $event->setRouter($sl->get('Router'));
         $event->setRouteMatch(new RouteMatch(array()));
         return new Service\ControllerService($eventManager, $event);
     }));
 }
 public function configureEvent()
 {
     $event = new \Zend\Mvc\MvcEvent();
     $event->setApplication($this->getApplication());
     return $event;
 }