/**
  * @covers \PhpCqrs\Domain\Message\MetaData\Exception\InvalidMetaDataPath::forPath
  */
 public function testCanConstructForPath()
 {
     $exception = InvalidMetaDataPath::forPath('foo bar');
     $this->assertInstanceOf(InvalidMetaDataPath::class, $exception);
     $this->assertSame('Meta data path "foo bar" is invalid.', $exception->getMessage());
 }
Example #2
0
 /**
  * @param string $path
  * @return string
  * @throws InvalidMetaDataPath
  */
 protected function validate($path)
 {
     if (!preg_match($this->validator, $path)) {
         throw InvalidMetaDataPath::forPath($path);
     }
     return $path;
 }