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 testSerializationAsYaml() { $text = Example1Representer::one($this->target)->toYAML(); $yaml = "titleAs: 'Cool story bro'\nstatus: 1\npubDate: '{$this->target->pubDate->format('Y-m-d')}'\n"; $this->assertEquals($text, $yaml); }