/** * @test */ public function itDoesNotChangeItselfWhenAnotherIsMerged() { $other = new Metadata(['other-key' => 'Yet another value', 'fourth-key' => 'Fourth value']); $this->metadata->merge($other); $this->assertSame('Some value', $this->metadata['some-key']); $this->assertSame('Other value', $this->metadata['other-key']); $this->assertSame('Third value', $this->metadata['third-key']); $this->assertNull($this->metadata['fourth-key']); }
/** * {@inheritdoc} */ public function enrichMetadata(Metadata $metadata) { return new static($this->eventId, $this->eventName, $this->event, $this->aggregateId, $this->aggregateVersion, $this->tookPlaceAt, $this->metadata->merge($metadata)); }