ProophTest\ServiceBus\Plugin\Router\RegexRouterTest::it_takes_a_routing_definition_on_instantiation PHP Method

it_takes_a_routing_definition_on_instantiation() public method

    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));
    }