/**
  * @test
  */
 public function it_injects_target_handler_to_event_dispatch_when_event_is_a_workflow_message()
 {
     $message = WorkflowMessage::newDataCollected(UserDictionary::fromNativeValue(['id' => 1, 'name' => 'John Doe', 'address' => ['street' => 'Main Street', 'streetNumber' => 10, 'zip' => '12345', 'city' => 'Test City']]), 'test-case', NodeName::defaultName());
     $eventDispatch = new EventDispatch();
     $eventDispatch->setEvent($message);
     $router = new SingleTargetMessageRouter($this->getTestWorkflowProcessor());
     $router->onRouteEvent($eventDispatch);
     $this->assertSame($this->getTestWorkflowProcessor(), $eventDispatch->getEventListeners()[0]);
 }
 public function onFinalizeEventDispatch(EventDispatch $eventDispatch)
 {
     if ($ex = $eventDispatch->getException()) {
         $successfulLogged = $this->logMessageProcessingFailed($eventDispatch->getEvent(), $ex);
         if ($successfulLogged) {
             $eventDispatch->setException(null);
         }
     } else {
         $this->logMessageProcessingSucceed($eventDispatch->getEvent());
     }
 }
 /**
  * @param EventDispatch $dispatch
  */
 public function onRouteEvent(EventDispatch $dispatch)
 {
     $dispatch->setEventListeners([$this->targetHandler]);
 }