These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\SeoBundle\Tests\Entity; |
||
4 | |||
5 | use Kunstmaan\SeoBundle\Entity\Seo; |
||
6 | |||
7 | /** |
||
8 | * Generated by PHPUnit_SkeletonGenerator on 2012-09-18 at 12:21:52. |
||
9 | */ |
||
10 | class SeoTest extends \PHPUnit_Framework_TestCase |
||
11 | { |
||
12 | /** |
||
13 | * @var Seo |
||
14 | */ |
||
15 | protected $object; |
||
16 | |||
17 | /** |
||
18 | * Sets up the fixture, for example, opens a network connection. |
||
19 | * This method is called before a test is executed. |
||
20 | */ |
||
21 | protected function setUp() |
||
22 | { |
||
23 | $this->object = new Seo(); |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * Tears down the fixture, for example, closes a network connection. |
||
28 | * This method is called after a test is executed. |
||
29 | */ |
||
30 | protected function tearDown() |
||
31 | { |
||
32 | } |
||
33 | |||
34 | // META DATA TESTS |
||
35 | /** |
||
36 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getMetaAuthor |
||
37 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setMetaAuthor |
||
38 | */ |
||
39 | public function testGetSetMetaAuthor() |
||
40 | { |
||
41 | $this->object->setMetaAuthor('Author Name'); |
||
42 | $this->assertEquals('Author Name', $this->object->getMetaAuthor()); |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getMetaDescription |
||
47 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setMetaDescription |
||
48 | */ |
||
49 | public function testGetSetMetaDescription() |
||
50 | { |
||
51 | $this->object->setMetaDescription('Meta Description'); |
||
52 | $this->assertEquals('Meta Description', $this->object->getMetaDescription()); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getMetaRobots |
||
57 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setMetaRobots |
||
58 | */ |
||
59 | public function testGetSetMetaRobots() |
||
60 | { |
||
61 | $this->object->setMetaRobots('noindex, nofollow'); |
||
62 | $this->assertEquals('noindex, nofollow', $this->object->getMetaRobots()); |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getExtraMetadata |
||
67 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setExtraMetadata |
||
68 | */ |
||
69 | public function testGetSetExtraMetadata() |
||
70 | { |
||
71 | $this->object->setExtraMetadata('Extra Metadata'); |
||
72 | $this->assertEquals('Extra Metadata', $this->object->getExtraMetadata()); |
||
73 | } |
||
74 | |||
75 | // OPEN GRAPH TESTS |
||
76 | /** |
||
77 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setOgDescription |
||
78 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getOgDescription |
||
79 | */ |
||
80 | public function testGetSetOgDescription() |
||
81 | { |
||
82 | $this->object->setOgDescription('OpenGraph description'); |
||
83 | $this->assertEquals('OpenGraph description', $this->object->getOgDescription()); |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setOgImage |
||
88 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getOgImage |
||
89 | */ |
||
90 | public function testGetSetOgImageWithImage() |
||
91 | { |
||
92 | $media = $this->getMock('Kunstmaan\MediaBundle\Entity\Media'); |
||
93 | $this->object->setOgImage($media); |
||
94 | $this->assertEquals($media, $this->object->getOgImage()); |
||
95 | } |
||
96 | |||
97 | /** |
||
98 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setOgImage |
||
99 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getOgImage |
||
100 | */ |
||
101 | public function testGetSetOgImageWithNullValue() |
||
102 | { |
||
103 | $this->object->setOgImage(null); |
||
104 | $this->assertEquals(null, $this->object->getOgImage()); |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setOgTitle |
||
109 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getOgTitle |
||
110 | */ |
||
111 | public function testGetSetOgTitle() |
||
112 | { |
||
113 | $this->object->setOgTitle('OpenGraph title'); |
||
114 | $this->assertEquals('OpenGraph title', $this->object->getOgTitle()); |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setOgType |
||
119 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getOgType |
||
120 | */ |
||
121 | public function testGetSetOgType() |
||
122 | { |
||
123 | $this->object->setOgType('website'); |
||
124 | $this->assertEquals('website', $this->object->getOgType()); |
||
125 | } |
||
126 | |||
127 | // TWITTER CARD TESTS |
||
128 | /** |
||
129 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setTwitterTitle |
||
130 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getTwitterTitle |
||
131 | */ |
||
132 | public function testGetSetTwitterTitle() |
||
133 | { |
||
134 | $this->object->setTwitterTitle('twitter title'); |
||
135 | $this->assertEquals('twitter title', $this->object->getTwitterTitle()); |
||
136 | } |
||
137 | |||
138 | /** |
||
139 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setTwitterDescription |
||
140 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getTwitterDescription |
||
141 | */ |
||
142 | public function testGetSetTwitterDescription() |
||
143 | { |
||
144 | $this->object->setTwitterDescription('twitter description'); |
||
145 | $this->assertEquals('twitter description', $this->object->getTwitterDescription()); |
||
146 | } |
||
147 | |||
148 | /** |
||
149 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setTwitterSite |
||
150 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getTwitterSite |
||
151 | */ |
||
152 | public function testGetSetTwitterSite() |
||
153 | { |
||
154 | $this->object->setTwitterSite('@kunstmaan'); |
||
155 | $this->assertEquals('@kunstmaan', $this->object->getTwitterSite()); |
||
156 | } |
||
157 | |||
158 | /** |
||
159 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setTwitterCreator |
||
160 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getTwitterCreator |
||
161 | */ |
||
162 | public function testGetSetTwitterCreator() |
||
163 | { |
||
164 | $this->object->setTwitterCreator('@denbatte'); |
||
165 | $this->assertEquals('@denbatte', $this->object->getTwitterCreator()); |
||
166 | } |
||
167 | |||
168 | /** |
||
169 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setTwitterImage |
||
170 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getTwitterImage |
||
171 | */ |
||
172 | public function testGetSetTwitterImageWithImage() |
||
173 | { |
||
174 | $media = $this->getMock('Kunstmaan\MediaBundle\Entity\Media'); |
||
0 ignored issues
–
show
|
|||
175 | $this->object->setTwitterImage($media); |
||
176 | $this->assertEquals($media, $this->object->getTwitterImage()); |
||
177 | } |
||
178 | |||
179 | /** |
||
180 | * @covers Kunstmaan\SeoBundle\Entity\Seo::setTwitterImage |
||
181 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getTwitterImage |
||
182 | */ |
||
183 | public function testGetSetTwitterImageWithNullValue() |
||
184 | { |
||
185 | $this->object->setTwitterImage(null); |
||
0 ignored issues
–
show
null is of type null , but the function expects a object<Kunstmaan\MediaBundle\Entity\Media> .
It seems like the type of the argument is not accepted by the function/method which you are calling. In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug. We suggest to add an explicit type cast like in the following example: function acceptsInteger($int) { }
$x = '123'; // string "123"
// Instead of
acceptsInteger($x);
// we recommend to use
acceptsInteger((integer) $x);
Loading history...
|
|||
186 | $this->assertEquals(null, $this->object->getTwitterImage()); |
||
187 | } |
||
188 | |||
189 | // HELPERS |
||
190 | /** |
||
191 | * @covers Kunstmaan\SeoBundle\Entity\Seo::getDefaultAdminType |
||
192 | */ |
||
193 | public function testGetDefaultAdminType() |
||
194 | { |
||
195 | $this->assertEquals('Kunstmaan\SeoBundle\Form\SeoType', $this->object->getDefaultAdminType()); |
||
196 | } |
||
197 | } |
||
198 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.