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