/**
  * @covers Desk\Relationship\Exception\InvalidLinkFormatException::fromLink
  * @dataProvider dataFromLink
  *
  * @param array  $link            The link to pass to fromLink()
  * @param string $expectedMessage The expected resulting message
  */
 public function testFromLink(array $link, $expectedMessage = null)
 {
     $exception = InvalidLinkFormatException::fromLink($link);
     $this->assertInstanceOf($this->getMockedClass(), $exception);
     if ($expectedMessage) {
         $this->assertSame($exception->getMessage(), $expectedMessage);
     }
 }
Beispiel #2
0
 /**
  * Validates link data (from an API response)
  *
  * @param array $data The link data from the API response
  *
  * @throws \Desk\Relationship\Exception\InvalidLinkFormatException
  */
 public function validateLink(array $data)
 {
     if (empty($data['href'])) {
         throw InvalidLinkFormatException::fromLink($data);
     }
 }