/**
  * @test
  */
 public function it_injects_target_handler_to_command_dispatch_when_command_is_a_workflow_message()
 {
     $message = WorkflowMessage::collectDataOf(UserDictionary::prototype(), 'test-case', NodeName::defaultName());
     $commandDispatch = new CommandDispatch();
     $commandDispatch->setCommand($message);
     $router = new SingleTargetMessageRouter($this->getTestWorkflowProcessor());
     $router->onRouteCommand($commandDispatch);
     $this->assertSame($this->getTestWorkflowProcessor(), $commandDispatch->getCommandHandler());
 }
 /**
  * @param CommandDispatch $commandDispatch
  */
 public function onFinalizeCommandDispatch(CommandDispatch $commandDispatch)
 {
     if ($ex = $commandDispatch->getException()) {
         $successfulLogged = $this->logMessageProcessingFailed($commandDispatch->getCommand(), $ex);
         if ($successfulLogged) {
             $commandDispatch->setException(null);
         }
     } else {
         $this->logMessageProcessingSucceed($commandDispatch->getCommand());
     }
 }
 /**
  * @param CommandDispatch $dispatch
  */
 public function onRouteCommand(CommandDispatch $dispatch)
 {
     $dispatch->setCommandHandler($this->targetHandler);
 }