1 | <?php |
||
17 | class SeoPageTest extends TestCase |
||
18 | { |
||
19 | public function testAddMeta() |
||
34 | |||
35 | public function testOverrideMetas() |
||
46 | |||
47 | public function testRemoveMeta() |
||
55 | |||
56 | public function testInvalidMetas() |
||
65 | |||
66 | public function testHtmlAttributes() |
||
67 | { |
||
68 | $page = new SeoPage(); |
||
69 | $page->setHtmlAttributes(['key1' => 'value1']); |
||
70 | $page->addHtmlAttributes('key2', 'value2'); |
||
71 | |||
72 | $expected = [ |
||
73 | 'key1' => 'value1', |
||
74 | 'key2' => 'value2', |
||
75 | ]; |
||
76 | |||
77 | $this->assertEquals($expected, $page->getHtmlAttributes()); |
||
78 | |||
79 | $this->assertTrue($page->hasHtmlAttribute('key2')); |
||
80 | $page->removeHtmlAttributes('key2'); |
||
81 | $this->assertFalse($page->hasHtmlAttribute('key2')); |
||
82 | } |
||
83 | |||
84 | public function testHeadAttributes() |
||
85 | { |
||
86 | $page = new SeoPage(); |
||
87 | $page->setHeadAttributes(['head1' => 'value1']); |
||
88 | $page->addHeadAttribute('head2', 'value2'); |
||
89 | |||
90 | $expected = [ |
||
91 | 'head1' => 'value1', |
||
92 | 'head2' => 'value2', |
||
93 | ]; |
||
94 | |||
95 | $this->assertEquals($expected, $page->getHeadAttributes()); |
||
96 | |||
97 | $this->assertTrue($page->hasHeadAttribute('head1')); |
||
98 | $page->removeHeadAttribute('head1'); |
||
99 | $this->assertFalse($page->hasHeadAttribute('head1')); |
||
100 | } |
||
101 | |||
102 | public function testSetTitle() |
||
109 | |||
110 | public function testAddTitle() |
||
119 | |||
120 | public function testLinkCanonical() |
||
121 | { |
||
122 | $page = new SeoPage(); |
||
123 | $page->setLinkCanonical('http://example.com'); |
||
124 | |||
125 | $this->assertEquals('http://example.com', $page->getLinkCanonical()); |
||
126 | |||
127 | $page->removeLinkCanonical(); |
||
128 | $this->assertEquals('', $page->getLinkCanonical()); |
||
129 | } |
||
130 | |||
131 | public function testLangAlternates() |
||
132 | { |
||
133 | $page = new SeoPage(); |
||
134 | $page->setLangAlternates(['http://example.com/' => 'x-default']); |
||
135 | $page->addLangAlternate('http://example.com/en-us', 'en-us'); |
||
136 | |||
137 | $expected = [ |
||
138 | 'http://example.com/' => 'x-default', |
||
139 | 'http://example.com/en-us' => 'en-us', |
||
140 | ]; |
||
141 | |||
142 | $this->assertEquals($expected, $page->getLangAlternates()); |
||
143 | |||
144 | $this->assertTrue($page->hasLangAlternate('http://example.com/')); |
||
145 | $page->removeLangAlternate('http://example.com/'); |
||
146 | $this->assertFalse($page->hasLangAlternate('http://example.com/')); |
||
147 | } |
||
148 | |||
149 | /** |
||
150 | * The hasMeta() should return true for a defined meta, false otherwise. |
||
151 | */ |
||
152 | public function testHasMeta() |
||
160 | |||
161 | public function testSetSeparator() |
||
167 | |||
168 | public function testSetStructuredData() |
||
169 | { |
||
170 | $page = new SeoPage(); |
||
171 | $structuredData = file_get_contents(__DIR__ . '/../Fixtures/structured_data.jsonld'); |
||
175 | } |
||
176 |
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: