ArticlePostMessageSpec::it_is_initializable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace spec\Yproximite\Api\Message\Article;
4
5
use PhpSpec\ObjectBehavior;
6
7
use Yproximite\Api\Model\Article\Article;
8
use Yproximite\Api\Message\Article\ArticlePostMessage;
9
use Yproximite\Api\Message\Article\ArticleMediaMessage;
10
use Yproximite\Api\Message\Article\ArticleTranslationMessage;
11
12
class ArticlePostMessageSpec extends ObjectBehavior
13
{
14
    function it_is_initializable()
15
    {
16
        $this->shouldHaveType(ArticlePostMessage::class);
17
    }
18
19 View Code Duplication
    function it_should_build()
0 ignored issues
show
Duplication introduced by
This method 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...
20
    {
21
        $translation = new ArticleTranslationMessage();
22
        $translation->setLocale('en');
23
        $translation->setTitle('English title');
24
        $translation->setBody('English content');
25
26
        $media = new ArticleMediaMessage();
27
        $media->setMediaId(1);
28
        $media->setDisplayOrder(5);
29
30
        $this->setStatus(Article::STATUS_PUBLISHED);
31
        $this->setCategoryIds([1, 2]);
32
        $this->setMediaLimit(5);
33
        $this->setShareOnFacebook(true);
34
        $this->addTranslation($translation);
35
        $this->addMedia($media);
36
37
        $translationData = [
38
            'title' => 'English title',
39
            'body'  => 'English content',
40
        ];
41
42
        $mediaData = [
43
            'media'        => 1,
44
            'displayOrder' => 5,
45
        ];
46
47
        $data = [
48
            'translations'    => ['en' => $translationData],
49
            'status'          => 'published',
50
            'categories'      => [1, 2],
51
            'articleMedias'   => [$mediaData],
52
            'mediaLimit'      => 5,
53
            'shareOnFacebook' => true,
54
        ];
55
56
        $this->build()->shouldReturn($data);
57
    }
58
}
59