1 | <?php |
||
29 | class HelperTest extends TestCaseAbstract |
||
30 | { |
||
31 | /** |
||
32 | * setUp |
||
33 | * |
||
34 | * @since 3.1.0 |
||
35 | */ |
||
36 | |||
37 | public function setUp() : void |
||
38 | { |
||
39 | parent::setUp(); |
||
40 | $optionArray = $this->getOptionArray(); |
||
41 | $installer = $this->installerFactory(); |
||
42 | $installer->init(); |
||
43 | $installer->rawCreate(); |
||
44 | $installer->insertSettings($optionArray); |
||
45 | $categoryOne = Db::forTablePrefix('categories')->create(); |
||
46 | $categoryOne |
||
47 | ->set( |
||
48 | [ |
||
49 | 'title' => 'Category One', |
||
50 | 'alias' => 'category-one' |
||
51 | ]) |
||
52 | ->save(); |
||
53 | $categoryTwo = Db::forTablePrefix('categories')->create(); |
||
54 | $categoryTwo |
||
55 | ->set( |
||
56 | [ |
||
57 | 'title' => 'Category Two', |
||
58 | 'alias' => 'category-two', |
||
59 | 'description' => 'Category Two', |
||
60 | 'keywords' => 'category, two', |
||
61 | 'robots' => 1 |
||
62 | ]) |
||
63 | ->save(); |
||
64 | $categoryThree = Db::forTablePrefix('categories')->create(); |
||
65 | $categoryThree |
||
66 | ->set( |
||
67 | [ |
||
68 | 'title' => 'Category Three', |
||
69 | 'alias' => 'category-three', |
||
70 | 'parent' => $categoryTwo->id |
||
71 | ]) |
||
72 | ->save(); |
||
73 | Db::forTablePrefix('articles') |
||
74 | ->create() |
||
75 | ->set( |
||
76 | [ |
||
77 | 'title' => 'Article One', |
||
78 | 'alias' => 'article-one', |
||
79 | 'category' => $categoryOne->id |
||
80 | ]) |
||
81 | ->save(); |
||
82 | Db::forTablePrefix('articles') |
||
83 | ->create() |
||
84 | ->set( |
||
85 | [ |
||
86 | 'title' => 'Article Two', |
||
87 | 'alias' => 'article-two', |
||
88 | 'description' => 'Article Two', |
||
89 | 'keywords' => 'article, two', |
||
90 | 'robots' => 0, |
||
91 | 'category' => $categoryTwo->id |
||
92 | ]) |
||
93 | ->save(); |
||
94 | Db::forTablePrefix('articles') |
||
95 | ->create() |
||
96 | ->set( |
||
97 | [ |
||
98 | 'title' => 'Article Three', |
||
99 | 'alias' => 'article-three', |
||
100 | 'category' => $categoryTwo->id |
||
101 | ]) |
||
102 | ->save(); |
||
103 | Db::forTablePrefix('articles') |
||
104 | ->create() |
||
105 | ->set( |
||
106 | [ |
||
107 | 'title' => 'Article Four', |
||
108 | 'alias' => 'article-four', |
||
109 | 'category' => $categoryThree->id |
||
110 | ]) |
||
111 | ->save(); |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * tearDown |
||
116 | * |
||
117 | * @since 3.1.0 |
||
118 | */ |
||
119 | |||
120 | public function tearDown() : void |
||
121 | { |
||
122 | $this->dropDatabase(); |
||
123 | } |
||
124 | |||
125 | /** |
||
126 | * testGetRegistry |
||
127 | * |
||
128 | * @since 2.6.0 |
||
129 | */ |
||
130 | |||
131 | public function testGetRegistry() : void |
||
145 | |||
146 | /** |
||
147 | * testGetLanguage |
||
148 | * |
||
149 | * @since 2.6.0 |
||
150 | */ |
||
151 | |||
152 | public function testGetLanguage() : void |
||
166 | |||
167 | /** |
||
168 | * testGetSetting |
||
169 | * |
||
170 | * @since 2.6.0 |
||
171 | */ |
||
172 | |||
173 | public function testGetSetting() : void |
||
183 | |||
184 | /** |
||
185 | * testGetTitle |
||
186 | * |
||
187 | * @since 3.0.0 |
||
188 | * |
||
189 | * @param array $registryArray |
||
190 | * @param array $settingArray |
||
191 | * @param string $expect |
||
192 | * |
||
193 | * @dataProvider providerAutoloader |
||
194 | */ |
||
195 | |||
196 | public function testGetTitle(array $registryArray = [], array $settingArray = [], string $expect = null) : void |
||
197 | { |
||
198 | /* setup */ |
||
199 | |||
200 | $this->_registry->init($registryArray); |
||
201 | $setting = $this->settingFactory(); |
||
202 | $setting->set('title', $settingArray['title']); |
||
203 | |||
204 | /* actual */ |
||
205 | |||
206 | $actual = Template\Helper::getTitle(); |
||
207 | |||
208 | /* compare */ |
||
209 | |||
210 | $this->assertEquals($expect, $actual); |
||
211 | } |
||
212 | |||
213 | /** |
||
214 | * testGetCanonical |
||
215 | * |
||
216 | * @since 3.0.0 |
||
217 | * |
||
218 | * @param array $registryArray |
||
219 | * @param string $expect |
||
220 | * |
||
221 | * @dataProvider providerAutoloader |
||
222 | */ |
||
223 | |||
224 | public function testGetCanonical(array $registryArray = [], string $expect = null) : void |
||
238 | |||
239 | /** |
||
240 | * testGetDescription |
||
241 | * |
||
242 | * @since 3.0.0 |
||
243 | * |
||
244 | * @param array $registryArray |
||
245 | * @param array $settingArray |
||
246 | * @param string $expect |
||
247 | * |
||
248 | * @dataProvider providerAutoloader |
||
249 | */ |
||
250 | |||
251 | public function testGetDescription(array $registryArray = [], array $settingArray = [], string $expect = null) : void |
||
267 | |||
268 | /** |
||
269 | * testGetKeywords |
||
270 | * |
||
271 | * @since 3.0.0 |
||
272 | * |
||
273 | * @param array $registryArray |
||
274 | * @param array $settingArray |
||
275 | * @param string $expect |
||
276 | * |
||
277 | * @dataProvider providerAutoloader |
||
278 | */ |
||
279 | |||
280 | public function testGetKeywords(array $registryArray = [], array $settingArray = [], string $expect = null) : void |
||
296 | |||
297 | /** |
||
298 | * testGetRobots |
||
299 | * |
||
300 | * @since 3.0.0 |
||
301 | * |
||
302 | * @param array $registryArray |
||
303 | * @param array $settingArray |
||
304 | * @param string $expect |
||
305 | * |
||
306 | * @dataProvider providerAutoloader |
||
307 | */ |
||
308 | |||
309 | public function testGetRobots(array $registryArray = [], array $settingArray = [], string $expect = null) : void |
||
325 | |||
326 | /** |
||
327 | * testGetTransport |
||
328 | * |
||
329 | * @since 3.0.0 |
||
330 | */ |
||
331 | |||
332 | public function testGetTransport() : void |
||
346 | |||
347 | /** |
||
348 | * testGetDirection |
||
349 | * |
||
350 | * @since 3.0.0 |
||
351 | * |
||
352 | * @param array $registryArray |
||
353 | * @param string $expect |
||
354 | * |
||
355 | * @dataProvider providerAutoloader |
||
356 | */ |
||
357 | |||
358 | public function testGetDirection(array $registryArray = [], string $expect = null) : void |
||
372 | |||
373 | /** |
||
374 | * testGetClass |
||
375 | * |
||
376 | * @since 3.0.0 |
||
377 | * |
||
378 | * @param array $registryArray |
||
379 | * @param string $expect |
||
380 | * |
||
381 | * @dataProvider providerAutoloader |
||
382 | */ |
||
383 | |||
384 | public function testGetClass(array $registryArray = [], string $expect = null) : void |
||
398 | } |
||
399 |