ProophTest\ServiceBus\Plugin\Router\AsyncSwitchMessageRouterTest::unmarked_message_is_passed_to_decorated_router PHP Метод

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

    public function unmarked_message_is_passed_to_decorated_router()
    {
        $messageProducer = $this->prophesize(MessageProducer::class);
        $decoratedRouter = $this->prophesize(SingleHandlerRouter::class);
        $message = NonAsyncCommand::createCommand('test-data');
        $actionEvent = new DefaultActionEvent(AsyncCommand::class, new CommandBus(), [MessageBus::EVENT_PARAM_MESSAGE_NAME => get_class($message), MessageBus::EVENT_PARAM_MESSAGE => $message]);
        $decoratedRouter->onRouteMessage($actionEvent)->willReturn('handled-by-decorated-router');
        $router = new AsyncSwitchMessageRouter($decoratedRouter->reveal(), $messageProducer->reveal());
        $rtn = $router->onRouteMessage($actionEvent);
        $this->assertEquals('handled-by-decorated-router', $rtn);
        $updatedMessage = $actionEvent->getParam(MessageBus::EVENT_PARAM_MESSAGE);
        $this->assertArrayNotHasKey('handled-async', $updatedMessage->metadata());
    }