/** * Test dispatcher method. */ public function testDispatcher() { $this->given($resolver = new HandlerClassResolver(new FromClassNameResolver(), new HandlerMethodNameDefaultResolver(), new InMemoryLocator([LoginUserCommand::class => new LoginUserCommandHandler()])))->and($middleware = new CommandHandlerMiddleware($resolver))->when($result = $middleware->resolver())->then()->object($result)->isEqualTo($resolver); }
/** * @param string $commandName * * @return object */ public function getHandlerFor($commandName) { $this->ensureCommandHandlerMiddleware(); return $this->commandHandlerMiddleware->resolver()->getHandlerFor($commandName); }