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