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

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

    public function marked_message_is_passed_to_async_producer()
    {
        $messageProducer = $this->prophesize(MessageProducer::class);
        $message = AsyncCommand::createCommand('test-data');
        $actionEvent = new DefaultActionEvent(AsyncCommand::class, new CommandBus(), [MessageBus::EVENT_PARAM_MESSAGE_NAME => get_class($message), MessageBus::EVENT_PARAM_MESSAGE => $message]);
        $router = new AsyncSwitchMessageRouter(new SingleHandlerRouter(), $messageProducer->reveal());
        $router->onRouteMessage($actionEvent);
        $this->assertEquals($messageProducer->reveal(), $actionEvent->getParam(MessageBus::EVENT_PARAM_MESSAGE_HANDLER));
        $updatedMessage = $actionEvent->getParam(MessageBus::EVENT_PARAM_MESSAGE);
        $this->assertArrayHasKey('handled-async', $updatedMessage->metadata());
        $this->assertTrue($updatedMessage->metadata()['handled-async']);
    }