Example #1
0
 public function testReconstructUsingExistingData()
 {
     $metadata = Metadata::from(['foo' => 'bar']);
     $id = Uuid::uuid4();
     $timestamp = DateTime::microsecondsNow();
     $eventMessage = new GenericEventMessage(new SomePayload(), $metadata, $id, $timestamp);
     $this->assertSame($timestamp, $eventMessage->getTimestamp());
     $this->assertSame($id, $eventMessage->getId());
     $this->assertSame($metadata, $eventMessage->getMetadata());
 }
Example #2
0
 /**
  * @return array
  */
 public function jsonSerialize()
 {
     $data = parent::jsonSerialize();
     $data['aggregateType'] = $this->aggregateType;
     $data['aggregateId'] = $this->aggregateId;
     return $data;
 }