예제 #1
0
 private function serializeList(ItemList $list)
 {
     $serialization = [];
     foreach ($list->getElements() as $element) {
         $serialization[] = $this->serializeElement($element);
     }
     return $serialization;
 }
예제 #2
0
 public function testSetAndGetElements()
 {
     $items = [(new ItemListElement())->setItemId(new ItemId('Q1'))->setLastUpdate('2014-08-16T19:52:04Z')->setWikidataPageUrl('https://www.wikidata.org/entity/Q1')->setQueryrApiUrl('http://api.queryr.com/items/Q1'), (new ItemListElement())->setItemId(new ItemId('Q2'))->setLastUpdate('2014-05-30T16:31:27Z')->setWikidataPageUrl('https://www.wikidata.org/entity/Q2')->setQueryrApiUrl('http://api.queryr.com/items/Q2')];
     $list = new ItemList($items);
     $this->assertSame($items, $list->getElements());
 }