ProophTest\ServiceBus\CommandBusTest::it_uses_the_fqcn_of_the_message_if_message_name_was_not_provided_and_message_does_not_implement_has_message_name PHP Method

it_uses_the_fqcn_of_the_message_if_message_name_was_not_provided_and_message_does_not_implement_has_message_name() public method

    public function it_uses_the_fqcn_of_the_message_if_message_name_was_not_provided_and_message_does_not_implement_has_message_name()
    {
        $handler = new MessageHandler();
        $this->commandBus->getActionEventEmitter()->attachListener(MessageBus::EVENT_ROUTE, function (ActionEvent $e) use($handler) {
            if ($e->getParam(MessageBus::EVENT_PARAM_MESSAGE_NAME) === CustomMessage::class) {
                $e->setParam(MessageBus::EVENT_PARAM_MESSAGE_HANDLER, $handler);
            }
        });
        $customMessage = new CustomMessage("foo");
        $this->commandBus->dispatch($customMessage);
        $this->assertSame($customMessage, $handler->getLastMessage());
    }