Completed
Push — 2.0 ( 95f77b...f37c7a )
by Nicolas
24:58 queued 15:12
created

EloquentPostRepositoryTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 26
rs 10
1
<?php
2
3
namespace Modules\Blog\Tests;
4
5
use Modules\Blog\Entities\Status;
6
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