AssetManager\Module::onBootstrap PHP Method

onBootstrap() public method

{@inheritDoc}
public onBootstrap ( Zend\EventManager\EventInterface $event )
$event Zend\EventManager\EventInterface
    public function onBootstrap(EventInterface $event)
    {
        // Attach for dispatch, and dispatch.error (with low priority to make sure statusCode gets set)
        /* @var $eventManager \Zend\EventManager\EventManagerInterface */
        $eventManager = $event->getTarget()->getEventManager();
        $callback = array($this, 'onDispatch');
        $priority = -9999999;
        $eventManager->attach(MvcEvent::EVENT_DISPATCH, $callback, $priority);
        $eventManager->attach(MvcEvent::EVENT_DISPATCH_ERROR, $callback, $priority);
    }

Usage Example

Ejemplo n.º 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);
 }
All Usage Examples Of AssetManager\Module::onBootstrap