public function testSerialization()
 {
     $author = new Author('first', 'last');
     $serialized = $author->serialize();
     $deserialized = Author::deserialize($serialized);
     self::assertEquals($author, $deserialized);
 }
Exemple #2
0
 /**
  * @param array $data
  * @return Authors
  */
 public static function deserialize(array $data)
 {
     assert(array_key_exists('elements', $data));
     return new self(array_map(function (array $element) {
         return Author::deserialize($element);
     }, $data['elements']));
 }