| 1 | <?php |
||
| 7 | class EloquentPostRepositoryTest extends BaseBlogTestCase |
||
| 8 | { |
||
| 9 | /** @test */ |
||
| 10 | public function it_should_only_returns_translated_posts() |
||
| 11 | { |
||
| 12 | // Prepare |
||
| 13 | $this->createBlogPost(); |
||
| 14 | $this->createBlogPost(); |
||
| 15 | $data = [ |
||
| 16 | 'en' => [ |
||
| 17 | 'title' => 'One language title', |
||
| 18 | 'slug' => 'slug', |
||
| 19 | 'content' => 'lorem ipsum', |
||
| 20 | ], |
||
| 21 | 'category_id' => 1, |
||
| 22 | 'status' => Status::PUBLISHED, |
||
| 23 | ]; |
||
| 24 | $this->post->create($data); |
||
| 25 | |||
| 26 | // Assert |
||
| 27 | $englishPosts = $this->post->allTranslatedIn('en'); |
||
| 28 | $this->assertEquals(3, $englishPosts->count()); |
||
| 29 | $frenchPosts = $this->post->allTranslatedIn('fr'); |
||
| 30 | $this->assertEquals(2, $frenchPosts->count()); |
||
| 31 | } |
||
| 32 | } |
||
| 33 |