public onLocateMessageHandler ( Prooph\Common\Event\ActionEvent $actionEvent ) | ||
$actionEvent | Prooph\Common\Event\ActionEvent |
/** * @test */ public function it_locates_a_service_using_the_message_handler_param_of_the_action_event() { $handler = new MessageHandler(); $container = $this->prophesize(ContainerInterface::class); $container->has("custom-handler")->willReturn(true); $container->get("custom-handler")->willReturn($handler); $locatorPlugin = new ServiceLocatorPlugin($container->reveal()); $actionEvent = new DefaultActionEvent(MessageBus::EVENT_LOCATE_HANDLER, new CommandBus(), [MessageBus::EVENT_PARAM_MESSAGE_HANDLER => "custom-handler"]); $locatorPlugin->onLocateMessageHandler($actionEvent); $this->assertSame($handler, $actionEvent->getParam(MessageBus::EVENT_PARAM_MESSAGE_HANDLER)); }