/**
  * {@inheritDoc}
  */
 public function enrich(Metadata $metadata)
 {
     if (null === $this->event) {
         return $metadata;
     }
     $data = array('console' => array('command' => get_class($this->event->getCommand()), 'arguments' => $this->event->getInput()->__toString()));
     $newMetadata = new Metadata($data);
     return $metadata->merge($newMetadata);
 }
Пример #2
0
 /**
  * @test
  */
 public function it_merges_the_metadata_instances_on_andMetadata()
 {
     $domainMessage = DomainMessage::recordNow('id', 42, Metadata::kv('bar', 1337), 'payload');
     $newMessage = $domainMessage->andMetadata(Metadata::kv('foo', 42));
     $expected = new Metadata(array('bar' => 1337, 'foo' => 42));
     $this->assertEquals($expected, $newMessage->getMetadata());
 }
 /**
  * @inheritdoc
  */
 public function deserialize(StringLiteral $data)
 {
     $data = parent::deserialize($data);
     $payloadClass = $this->payloadClass;
     return new DomainMessage($data['id'], $data['playhead'], Metadata::deserialize($data['metadata']), $payloadClass::deserialize($data['payload']), DateTime::fromString($data['recorded_on']));
 }
 public function enrich(Metadata $metadata)
 {
     $this->calls[] = $metadata;
     return $metadata->merge(Metadata::kv('traced', true));
 }
Пример #5
0
 /**
  * @test
  */
 public function it_constructs_an_instance_containing_the_key_and_value()
 {
     $m1 = Metadata::kv('foo', 42);
     $expected = new Metadata(array('foo' => 42));
     $this->assertEquals($expected, $m1);
 }
 private function givenMetadataContainsNothing()
 {
     $this->metadata->shouldReceive('serialize')->andReturn([]);
 }
Пример #7
0
 /**
  * Add the context info to the Metadata
  *
  * @param  Metadata $metadata
  *
  * @return Metadata
  */
 public function enrich(Metadata $metadata)
 {
     return $metadata->merge(new Metadata([static::CONTEXT => ContextContainer::getContext()]));
 }