onRouteEvent() public method

Deprecation: Will be removed with v6.0, use method onRouteMessage instead
public onRouteEvent ( Prooph\Common\Event\ActionEvent $actionEvent )
$actionEvent Prooph\Common\Event\ActionEvent
Ejemplo n.º 1
0
 /**
  * @test
  */
 public function it_still_works_if_deprecated_method_on_route_event_is_used()
 {
     $router = new EventRouter(['SomethingDone' => ['SomethingDoneListener1', 'SomethingDoneListener2']]);
     $actionEvent = new DefaultActionEvent(MessageBus::EVENT_ROUTE, new EventBus(), [MessageBus::EVENT_PARAM_MESSAGE_NAME => 'SomethingDone']);
     $router->onRouteEvent($actionEvent);
     $this->assertEquals("SomethingDoneListener1", $actionEvent->getParam(EventBus::EVENT_PARAM_EVENT_LISTENERS)[0]);
     $this->assertEquals("SomethingDoneListener2", $actionEvent->getParam(EventBus::EVENT_PARAM_EVENT_LISTENERS)[1]);
 }
Ejemplo n.º 2
0
 /**
  * @test
  */
 public function it_returns_early_on_route_event_when_message_name_is_not_in_event_map()
 {
     $router = new EventRouter(['SomethingDone' => ['SomethingDoneListener1', 'SomethingDoneListener2']]);
     $actionEvent = new DefaultActionEvent(MessageBus::EVENT_ROUTE, new EventBus(), [MessageBus::EVENT_PARAM_MESSAGE_NAME => 'unknown']);
     $router->onRouteEvent($actionEvent);
     $listeners = $actionEvent->getParam(EventBus::EVENT_PARAM_EVENT_LISTENERS);
     $this->assertEmpty($listeners);
 }