public function testCollectionRestore() { $objCollection = [clone $this->target, clone $this->target, clone $this->target]; $collProjection = Example1Representer::collection($objCollection)->toArray(); $restoredCollection = Example1Representer::restoreCollection(Example1::class)->fromArray($collProjection); $this->assertEquals(count($objCollection), count($restoredCollection)); foreach ($restoredCollection as $key => $object) { $this->assertEquals($objCollection[$key]->title, $object->title); $this->assertEquals($objCollection[$key]->status, $object->status); $this->assertEquals($objCollection[$key]->pubDate, $object->pubDate); } }