public function testRestore() { $projection = Post1Representer::one($this->target)->toArray(); $post = Post1Representer::restore(Post::class)->fromArray($projection); $this->assertInstanceOf(Post::class, $post); $this->assertEquals($post->title, $this->target->title); $this->assertEquals($post->status, $this->target->status); $this->assertEquals($post->pubDate->format('Y-m-d'), $this->target->pubDate->format('Y-m-d')); }
public function testDeserializationFromYaml() { $yaml = "titleAs: 'Cool story bro'\nstatus: 1\npubDate: '2016-01-18'\n"; $object = Post1Representer::restore(Post::class)->fromYAML($yaml); $this->assertInstanceOf(Post::class, $object); }