public static createCommand ( string $data ) : |
||
$data | string | |
Результат |
/** * @test */ public function marked_message_is_passed_to_decorated_router_as_already_handled_by_async_provider() { $messageProducer = $this->prophesize(MessageProducer::class); $decoratedRouter = $this->prophesize(SingleHandlerRouter::class); $message = AsyncCommand::createCommand('test-data'); $message = $message->withAddedMetadata('handled-async', true); $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->assertArrayHasKey('handled-async', $updatedMessage->metadata()); $this->assertTrue($updatedMessage->metadata()['handled-async']); }