|
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\SummaryLargeImageCard; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* @mixin \Sylius\Component\Metadata\Model\Twitter\SummaryLargeImageCard |
|
20
|
|
|
* |
|
21
|
|
|
* @author Kamil Kokot <[email protected]> |
|
22
|
|
|
*/ |
|
23
|
|
|
class SummaryLargeImageCardSpec extends ObjectBehavior |
|
24
|
|
|
{ |
|
25
|
|
|
function it_is_initializable() |
|
26
|
|
|
{ |
|
27
|
|
|
$this->shouldHaveType('Sylius\Component\Metadata\Model\Twitter\SummaryLargeImageCard'); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
function it_implements_Summary_Large_Image_Card_interface() |
|
31
|
|
|
{ |
|
32
|
|
|
$this->shouldImplement('Sylius\Component\Metadata\Model\Twitter\SummaryLargeImageCardInterface'); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
function it_is_serializable() |
|
36
|
|
|
{ |
|
37
|
|
|
$that = new SummaryLargeImageCard(); |
|
38
|
|
|
$that->setTitle('Lorem ipsum'); |
|
39
|
|
|
|
|
40
|
|
|
$that = unserialize(serialize($that)); |
|
41
|
|
|
|
|
42
|
|
|
\PHPUnit_Framework_Assert::assertEquals('Lorem ipsum', $that->getTitle()); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
function it_is_mergable_with_same_class_object() |
|
46
|
|
|
{ |
|
47
|
|
|
$metadata = new SummaryLargeImageCard(); |
|
48
|
|
|
$metadata->setTitle('Lorem ipsum'); |
|
49
|
|
|
$metadata->setDescription('Lorem ipsum dolor sit amet'); |
|
50
|
|
|
|
|
51
|
|
|
$this->setTitle('Death Star'); |
|
52
|
|
|
$this->setSite('@pamilme'); |
|
53
|
|
|
|
|
54
|
|
|
$this->merge($metadata); |
|
55
|
|
|
|
|
56
|
|
|
$this->getTitle()->shouldReturn('Death Star'); |
|
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('summary_large_image'); |
|
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_creator() |
|
88
|
|
|
{ |
|
89
|
|
|
$this->getCreator()->shouldReturn(null); |
|
90
|
|
|
|
|
91
|
|
|
$this->setCreator('@pamilme'); |
|
92
|
|
|
$this->getCreator()->shouldReturn('@pamilme'); |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
function it_has_creator_id() |
|
96
|
|
|
{ |
|
97
|
|
|
$this->getCreatorId()->shouldReturn(null); |
|
98
|
|
|
|
|
99
|
|
|
$this->setCreatorId('753686598'); |
|
100
|
|
|
$this->getCreatorId()->shouldReturn('753686598'); |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
function it_has_title() |
|
104
|
|
|
{ |
|
105
|
|
|
$this->getTitle()->shouldReturn(null); |
|
106
|
|
|
|
|
107
|
|
|
$this->setTitle('Lorem ipsum'); |
|
108
|
|
|
$this->getTitle()->shouldReturn('Lorem ipsum'); |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
function it_has_description() |
|
112
|
|
|
{ |
|
113
|
|
|
$this->getDescription()->shouldReturn(null); |
|
114
|
|
|
|
|
115
|
|
|
$this->setDescription('Lorem ipsum dolor sit amet'); |
|
116
|
|
|
$this->getDescription()->shouldReturn('Lorem ipsum dolor sit amet'); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
function it_has_image() |
|
120
|
|
|
{ |
|
121
|
|
|
$this->getImage()->shouldReturn(null); |
|
122
|
|
|
|
|
123
|
|
|
$this->setImage('http://sylius.org/assets/img/logo.png'); |
|
124
|
|
|
$this->getImage()->shouldReturn('http://sylius.org/assets/img/logo.png'); |
|
125
|
|
|
} |
|
126
|
|
|
} |
|
127
|
|
|
|