it_should_create_from_article_translation()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13

Duplication

Lines 13
Ratio 100 %

Importance

Changes 0
Metric Value
dl 13
loc 13
rs 9.8333
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace spec\Yproximite\Api\Message\Article;
4
5
use PhpSpec\ObjectBehavior;
6
7
use Yproximite\Api\Model\Article\ArticleTranslation;
8
use Yproximite\Api\Message\Article\ArticleTranslationMessage;
9
10 View Code Duplication
class ArticleTranslationMessageSpec extends ObjectBehavior
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    function it_is_initializable()
13
    {
14
        $this->shouldHaveType(ArticleTranslationMessage::class);
15
    }
16
17
    function it_should_build()
18
    {
19
        $this->setTitle('Big title');
20
        $this->setBody('Long body');
21
22
        $data = [
23
            'title' => 'Big title',
24
            'body'  => 'Long body',
25
        ];
26
27
        $this->build()->shouldReturn($data);
28
    }
29
30
    function it_should_create_from_article_translation(ArticleTranslation $translation)
31
    {
32
        $translation->getLocale()->willReturn('en');
33
        $translation->getTitle()->willReturn('Big title');
34
        $translation->getBody()->willReturn('Long body');
35
36
        $message = new ArticleTranslationMessage();
37
        $message->setLocale('en');
38
        $message->setTitle('Big title');
39
        $message->setBody('Long body');
40
41
        $this::createFromArticleTranslation($translation)->shouldBeLike($message);
42
    }
43
}
44