onRouteMessage() публичный Метод

public onRouteMessage ( Prooph\Common\Event\ActionEvent $actionEvent )
$actionEvent Prooph\Common\Event\ActionEvent
Пример #1
0
 /**
  * @test
  */
 public function it_takes_a_routing_definition_on_instantiation()
 {
     $router = new RegexRouter(['/^' . preg_quote('ProophTest\\ServiceBus\\Mock\\Do') . '.*/' => 'DoSomethingHandler', '/^' . preg_quote('ProophTest\\ServiceBus\\Mock\\') . '.*Done$/' => ["SomethingDoneListener1", "SomethingDoneListener2"]]);
     $actionEvent = new DefaultActionEvent(MessageBus::EVENT_ROUTE, new CommandBus(), [MessageBus::EVENT_PARAM_MESSAGE_NAME => 'ProophTest\\ServiceBus\\Mock\\DoSomething']);
     $router->onRouteMessage($actionEvent);
     $this->assertEquals("DoSomethingHandler", $actionEvent->getParam(MessageBus::EVENT_PARAM_MESSAGE_HANDLER));
     $actionEvent = new DefaultActionEvent(MessageBus::EVENT_ROUTE, new EventBus(), [MessageBus::EVENT_PARAM_MESSAGE_NAME => 'ProophTest\\ServiceBus\\Mock\\SomethingDone']);
     $router->onRouteMessage($actionEvent);
     $this->assertEquals(["SomethingDoneListener1", "SomethingDoneListener2"], $actionEvent->getParam(EventBus::EVENT_PARAM_EVENT_LISTENERS));
 }