Ejemplo n.º 1
0
 public function testEntityLink()
 {
     $rel = new Rel('http://x.io/rels/order-items');
     $subEntity = new EntityLink('http://api.x.io/orders/42/items');
     $subEntity->addClass('items');
     $subEntity->addClass('collection');
     $entity = new Entity();
     $entity->addEntityLink($rel, $subEntity);
     $expectedJson = json_encode(array('entities' => array(array('class' => array('items', 'collection'), 'rel' => array('http://x.io/rels/order-items'), 'href' => 'http://api.x.io/orders/42/items'))));
     $this->assertJsonStringEqualsJsonString($expectedJson, json_encode($entity));
 }