EloquentPostRepositoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
c 2
b 0
f 0
lcom 1
cbo 1
dl 0
loc 25
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A it_should_only_returns_translated_posts() 0 21 1
1
<?php namespace Modules\Blog\Tests;
2
3
class EloquentPostRepositoryTest extends BaseBlogTestCase
4
{
5
    /** @test */
6
    public function it_should_only_returns_translated_posts()
7
    {
8
        // Prepare
9
        $this->createBlogPost();
10
        $this->createBlogPost();
11
        $data = [
12
            'en' => [
13
                'title' => 'One language title',
14
                'slug' => 'slug',
15
                'content' => 'lorem ipsum',
16
            ],
17
            'category_id' => 1,
18
        ];
19
        $this->post->create($data);
20
21
        // Assert
22
        $englishPosts = $this->post->allTranslatedIn('en');
23
        $this->assertEquals(3, $englishPosts->count());
24
        $frenchPosts = $this->post->allTranslatedIn('fr');
25
        $this->assertEquals(2, $frenchPosts->count());
26
    }
27
}
28