public function testSerializeVersionedGreater() { $author = new Serializer\TestAuthor(); $author->setName('bar'); $object = new Serializer\TestObjectVersioned(); $object->setTitle('foo'); $object->setAuthor($author); $return = Environment::getService('serializer')->serialize($object, new Version(2)); $expect = array(); $expect['title'] = 'foo'; $expect['author'] = array(); $expect['author']['name'] = 'bar'; $this->assertEquals($expect, $return); }
protected function getEntry() { $entries = array(); $author = new Serializer\TestAuthor(); $author->setName('bar'); $object = new Serializer\TestObject(); $object->setTitle('foo'); $object->setAuthor($author); $object->setContributors([$author, $author]); $object->setTags(['foo', 'bar']); $entries[] = $object; $author = new Serializer\TestAuthor(); $author->setName('bar'); $object = new Serializer\TestObject(); $object->setTitle('bar'); $object->setAuthor($author); $object->setContributors([$author, $author]); $object->setTags(['foo', 'bar']); $entries[] = $object; return $entries; }