Ejemplo n.º 1
0
 /**
  * @dataProvider getInvalidMessageRefs
  *
  * @param string $string
  */
 public function testInvalidMessageRefs($string)
 {
     try {
         $ref = MessageRef::fromString($string);
     } catch (\Exception $e) {
         $this->assertTrue(true, sprintf('MessageRef correctly failed on string [%s].', $string));
         return;
     }
     $this->fail(sprintf('MessageRef accepted and invalid string [%s].', $string));
 }
Ejemplo n.º 2
0
 /**
  * @param MessageRef $other
  * @return bool
  */
 public function equals(MessageRef $other)
 {
     return $this->toString() === $other->toString();
 }
Ejemplo n.º 3
0
 /**
  * @param mixed $value
  * @param Field $field
  *
  * @return MessageRef
  */
 public function decodeMessageRef($value, Field $field)
 {
     return MessageRef::fromArray($value);
 }
Ejemplo n.º 4
0
 /**
  * @param MessageRef $messageRef
  * @param Field $field
  *
  * @return mixed
  */
 public function encodeMessageRef(MessageRef $messageRef, Field $field)
 {
     return ['M' => ['curie' => [self::TYPE_STRING => $messageRef->getCurie()->toString()], 'id' => [self::TYPE_STRING => $messageRef->getId()], 'tag' => $messageRef->hasTag() ? [self::TYPE_STRING => $messageRef->getTag()] : ['NULL' => true]]];
 }