public function andMetaData(array $metadata = array()) { if (empty($metadata)) { return $this; } return new GenericCommandMessage($this->payload, $this->metaData->mergeWith($metadata), $this->id, $this->commandName); }
/** * @covers Governor\Framework\Domain\MetaData::mergeWith */ public function testMergedMetaData() { $metaDataValues = array('first' => 'value'); $metaData = new MetaData($metaDataValues); $metaDataValues['second'] = 'value'; $metaDataValues['first'] = 'other'; $newMetaData = $metaData->mergeWith($metaDataValues); $this->assertEquals('other', $newMetaData->get('first')); $this->assertEquals('value', $newMetaData->get('second')); }