Completed
Push — master ( 90ccc1...22512f )
by Kamil
35:43
created

AppCardSpec::it_has_app_name_googleplay()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 7
rs 9.4285
c 1
b 0
f 1
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace spec\Sylius\Component\Metadata\Model\Twitter;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Component\Metadata\Model\MetadataInterface;
16
use Sylius\Component\Metadata\Model\Twitter\AppCard;
17
18
/**
19
 * @mixin \Sylius\Component\Metadata\Model\Twitter\AppCard
20
 *
21
 * @author Kamil Kokot <[email protected]>
22
 */
23
class AppCardSpec extends ObjectBehavior
24
{
25
    function it_is_initializable()
26
    {
27
        $this->shouldHaveType('Sylius\Component\Metadata\Model\Twitter\AppCard');
28
    }
29
30
    function it_implements_App_Card_interface()
31
    {
32
        $this->shouldImplement('Sylius\Component\Metadata\Model\Twitter\AppCardInterface');
33
    }
34
35
    function it_is_serializable()
36
    {
37
        $that = new AppCard();
38
        $that->setDescription('Lorem ipsum');
39
40
        $that = unserialize(serialize($that));
41
42
        \PHPUnit_Framework_Assert::assertEquals('Lorem ipsum', $that->getDescription());
43
    }
44
45
    function it_is_mergable_with_same_class_object()
46
    {
47
        $metadata = new AppCard();
48
        $metadata->setSiteId('42');
49
        $metadata->setDescription('Lorem ipsum dolor sit amet');
50
51
        $this->setSiteId('753686598');
52
        $this->setSite('@pamilme');
53
54
        $this->merge($metadata);
55
56
        $this->getSiteId()->shouldReturn('753686598');
57
        $this->getDescription()->shouldReturn('Lorem ipsum dolor sit amet');
58
        $this->getSite()->shouldReturn('@pamilme');
59
    }
60
61
    function it_can_not_merge_with_different_class_object(MetadataInterface $metadata)
62
    {
63
        $this->shouldThrow('\InvalidArgumentException')->duringMerge($metadata);
64
    }
65
66
    function it_has_correct_type()
67
    {
68
        $this->getType()->shouldReturn('app');
69
    }
70
71
    function it_has_site()
72
    {
73
        $this->getSite()->shouldReturn(null);
74
75
        $this->setSite('@pamilme');
76
        $this->getSite()->shouldReturn('@pamilme');
77
    }
78
79
    function it_has_site_id()
80
    {
81
        $this->getSiteId()->shouldReturn(null);
82
83
        $this->setSiteId('753686598');
84
        $this->getSiteId()->shouldReturn('753686598');
85
    }
86
87
    function it_has_description()
88
    {
89
        $this->getDescription()->shouldReturn(null);
90
91
        $this->setDescription('Lorem ipsum dolor sit amet');
92
        $this->getDescription()->shouldReturn('Lorem ipsum dolor sit amet');
93
    }
94
95
    function it_has_app_name_iphone()
96
    {
97
        $this->getAppNameIphone()->shouldReturn(null);
98
99
        $this->setAppNameIphone('Iphone App');
100
        $this->getAppNameIphone()->shouldReturn('Iphone App');
101
    }
102
103
    function it_has_app_id_iphone()
104
    {
105
        $this->getAppIdIphone()->shouldReturn(null);
106
107
        $this->setAppIdIphone('Iphone App ID');
108
        $this->getAppIdIphone()->shouldReturn('Iphone App ID');
109
    }
110
111
    function it_has_app_url_iphone()
112
    {
113
        $this->getAppUrlIphone()->shouldReturn(null);
114
115
        $this->setAppUrlIphone('https://example.com/iphone_app');
116
        $this->getAppUrlIphone()->shouldReturn('https://example.com/iphone_app');
117
    }
118
119
    function it_has_app_name_ipad()
120
    {
121
        $this->getAppNameIpad()->shouldReturn(null);
122
123
        $this->setAppNameIpad('Ipad App');
124
        $this->getAppNameIpad()->shouldReturn('Ipad App');
125
    }
126
127
    function it_has_app_id_ipad()
128
    {
129
        $this->getAppIdIpad()->shouldReturn(null);
130
131
        $this->setAppIdIpad('Ipad App ID');
132
        $this->getAppIdIpad()->shouldReturn('Ipad App ID');
133
    }
134
135
    function it_has_app_url_ipad()
136
    {
137
        $this->getAppUrlIpad()->shouldReturn(null);
138
139
        $this->setAppUrlIpad('https://example.com/ipad_app');
140
        $this->getAppUrlIpad()->shouldReturn('https://example.com/ipad_app');
141
    }
142
143
    function it_has_app_name_googleplay()
144
    {
145
        $this->getAppNameGoogleplay()->shouldReturn(null);
146
147
        $this->setAppNameGoogleplay('Googleplay App');
148
        $this->getAppNameGoogleplay()->shouldReturn('Googleplay App');
149
    }
150
151
    function it_has_app_id_googleplay()
152
    {
153
        $this->getAppIdGoogleplay()->shouldReturn(null);
154
155
        $this->setAppIdGoogleplay('Googleplay App ID');
156
        $this->getAppIdGoogleplay()->shouldReturn('Googleplay App ID');
157
    }
158
159
    function it_has_app_url_googleplay()
160
    {
161
        $this->getAppUrlGoogleplay()->shouldReturn(null);
162
163
        $this->setAppUrlGoogleplay('https://example.com/googleplay_app');
164
        $this->getAppUrlGoogleplay()->shouldReturn('https://example.com/googleplay_app');
165
    }
166
}
167