示例#1
0
 /** @test **/
 public function it_fetches_the_cover_associated_with_the_post()
 {
     $this->createComponent('posts');
     $this->createComponent('cover_photos');
     $this->insertOn('posts', ['title' => 'Random Blog Post']);
     $this->insertOn('cover_photos', ['image' => '/path/to/image.jpg']);
     Post::usesOne(CoverPhoto::class);
     CoverPhoto::first()->registerTo(Post::first());
     $cover = Post::first()->cover_photo;
     $this->assertEquals('/path/to/image.jpg', $cover->image);
 }