Inheritance: implements Zend\ModuleManager\Feature\AutoloaderProviderInterface, implements Zend\ModuleManager\Feature\ConfigProviderInterface, implements Zend\ModuleManager\Feature\BootstrapListenerInterface
示例#1
0
 public function testOnBootstrap()
 {
     $applicationEventManager = new EventManager();
     $application = $this->getMock(ApplicationInterface::class);
     $application->expects($this->any())->method('getEventManager')->will($this->returnValue($applicationEventManager));
     $event = new Event();
     $event->setTarget($application);
     $module = new Module();
     $module->onBootstrap($event);
     $this->assertListenerAtPriority([$module, 'onDispatch'], -9999999, MvcEvent::EVENT_DISPATCH, $applicationEventManager);
     $this->assertListenerAtPriority([$module, 'onDispatch'], -9999999, MvcEvent::EVENT_DISPATCH_ERROR, $applicationEventManager);
 }
示例#2
0
 public function testOnBootstrap()
 {
     $applicationEventManager = new EventManager();
     $application = $this->getMock('Zend\\Mvc\\ApplicationInterface');
     $application->expects($this->any())->method('getEventManager')->will($this->returnValue($applicationEventManager));
     $event = new Event();
     $event->setTarget($application);
     $module = new Module();
     $module->onBootstrap($event);
     $dispatchListeners = $applicationEventManager->getListeners(MvcEvent::EVENT_DISPATCH);
     foreach ($dispatchListeners as $listener) {
         $metaData = $listener->getMetadata();
         $callback = $listener->getCallback();
         $this->assertEquals('onDispatch', $callback[1]);
         $this->assertEquals(-9999999, $metaData['priority']);
         $this->assertTrue($callback[0] instanceof Module);
     }
     $dispatchListeners = $applicationEventManager->getListeners(MvcEvent::EVENT_DISPATCH_ERROR);
     foreach ($dispatchListeners as $listener) {
         $metaData = $listener->getMetadata();
         $callback = $listener->getCallback();
         $this->assertEquals('onDispatch', $callback[1]);
         $this->assertEquals(-9999999, $metaData['priority']);
         $this->assertTrue($callback[0] instanceof Module);
     }
 }