Example #1
0
 public function testRemoveLink()
 {
     $res = new Response();
     $res->addLink('self', 'http://localhost/foo/bar');
     $res->addLink('next', 'http://localhost/foo/bar?page=2');
     $res->removeLink('self');
     $expected = array('links' => array(array('rel' => array('next'), 'href' => 'http://localhost/foo/bar?page=2')));
     $format = new Formatter\Siren($res);
     $this->assertEquals($expected, $format->toArray());
 }
Example #2
0
 public function testGetLinkByRel()
 {
     $url = 'http://placekitten.com/200/300';
     $res = new Response();
     $res->addLink('image_src', $url);
     $link = $res->getLink('image_src');
     $this->assertEquals($url, $link);
 }