public function testCorrelationDataIsAttached()
 {
     CorrelationDataHolder::setCorrelationData(array('correlationId' => 'test'));
     $this->testSubject->send(new HelloCommand('Hi !!!'));
     \Phake::verify($this->mockCommandBus)->dispatch(\Phake::capture($command), null);
     $this->assertEquals(array('correlationId' => 'test'), $command->getMetaData()->all());
 }
 public function tearDown()
 {
     CorrelationDataHolder::clear();
 }
 private function doInvokeSaga(EventMessageInterface $event, SagaInterface $saga)
 {
     try {
         CorrelationDataHolder::setCorrelationData($this->correlationDataProvider->correlationDataFor($event));
         $saga->handle($event);
     } catch (\RuntimeException $ex) {
         $this->handleInvokationException($ex, $event, $saga);
     }
 }
 /**
  * @param $command
  * @return GenericCommandMessage
  */
 protected function createCommandMessage($command)
 {
     $message = GenericCommandMessage::asCommandMessage($command);
     return $message->withMetaData(CorrelationDataHolder::getCorrelationData())->andMetaData($message->getMetaData()->all());
 }