public function testSubscribe()
 {
     $commandHandler = $this->getMock(CommandHandlerInterface::class);
     $this->subject->subscribe(get_class(new TestCommand('hi')), $commandHandler);
     $handler = $this->subject->findCommandHandlerFor(GenericCommandMessage::asCommandMessage(new TestCommand('hi')));
     $this->assertInstanceOf(CommandHandlerInterface::class, $handler);
 }
 public function testUnsubscribe_HandlerNotKnown()
 {
     $this->handlerRegistry->unsubscribe(TestCommand::class, new TestCommandHandler());
 }
 public function registerCommandHandler($commandName, CommandHandlerInterface $commandHandler)
 {
     $this->registerAggregateCommandHandlers();
     $this->explicitCommandHandlersSet = true;
     $this->handlerRegistry->subscribe($commandName, $commandHandler);
     return $this;
 }