1 | <?php |
||
21 | class ComponentLibraryTest extends PHPUnit_Framework_TestCase { |
||
22 | |||
23 | public function testCanConstruct() { |
||
30 | |||
31 | /** |
||
32 | * @param string $componentName |
||
33 | * @param string $expectedParserHookString |
||
34 | * |
||
35 | * @dataProvider compileParserHookStringProvider |
||
36 | */ |
||
37 | public function testCanCompileParserHookStringFor( $componentName, $expectedParserHookString ) { |
||
43 | |||
44 | public function testCanCompileMagicWordsArray() { |
||
57 | |||
58 | /** |
||
59 | * @param string $componentName |
||
60 | * |
||
61 | * @throws \ConfigException |
||
62 | * |
||
63 | * @dataProvider componentNameAndClassProvider |
||
64 | */ |
||
65 | public function testIsRegistered( $componentName ) { |
||
72 | |||
73 | /** |
||
74 | * @param string $component |
||
75 | * @param string[] $expectedAliases |
||
76 | * |
||
77 | * @throws \ConfigException |
||
78 | * @throws \MWException |
||
79 | * |
||
80 | * @dataProvider componentAliasesProvider |
||
81 | */ |
||
82 | public function testGetAliasesFor( $component, $expectedAliases ) { |
||
89 | |||
90 | /** |
||
91 | * @param string $component |
||
92 | * @param string[] $expectedAttributes |
||
93 | * |
||
94 | * @throws \ConfigException |
||
95 | * @throws \MWException |
||
96 | * |
||
97 | * @dataProvider componentAttributesProvider |
||
98 | */ |
||
99 | public function testGetAttributesFor( $component, $expectedAttributes ) { |
||
106 | |||
107 | /** |
||
108 | * @param string $componentName |
||
109 | * @param string $componentClass |
||
110 | * |
||
111 | * @throws \ConfigException |
||
112 | * |
||
113 | * @dataProvider componentNameAndClassProvider |
||
114 | */ |
||
115 | public function testGetClassFor( $componentName, $componentClass ) { |
||
122 | |||
123 | /** |
||
124 | * @throws \ConfigException |
||
125 | */ |
||
126 | public function testGetAllRegisteredComponents() { |
||
133 | |||
134 | /** |
||
135 | * @param string $componentName |
||
136 | * |
||
137 | * @throws \ConfigException |
||
138 | * |
||
139 | * @dataProvider componentNameAndClassProvider |
||
140 | */ |
||
141 | public function testGetHandlerTypeFor( $componentName ) { |
||
149 | |||
150 | /** |
||
151 | * @throws \ConfigException |
||
152 | */ |
||
153 | public function testGetHandlerTypeForUnknownComponent() { |
||
161 | |||
162 | /** |
||
163 | * @param string $componentName |
||
164 | * @param bool $isParserFunction |
||
165 | * |
||
166 | * @throws \ConfigException |
||
167 | * |
||
168 | * @dataProvider handlerTypeProvider |
||
169 | */ |
||
170 | public function testIsHandlerType( $componentName, $isParserFunction ) { |
||
180 | |||
181 | /** |
||
182 | * @param string $componentName |
||
183 | * @param string $skinName |
||
184 | * @param array $expectedModules |
||
185 | * |
||
186 | * @throws \ConfigException |
||
187 | * |
||
188 | * @dataProvider modulesForComponentsProvider |
||
189 | */ |
||
190 | public function testGetModulesFor( $componentName, $skinName, $expectedModules ) { |
||
197 | |||
198 | /** |
||
199 | * @param string $componentName |
||
200 | * @param string $componentClass |
||
201 | * |
||
202 | * @throws \ConfigException |
||
203 | * @throws \MWException |
||
204 | * |
||
205 | * @dataProvider componentNameAndClassProvider |
||
206 | */ |
||
207 | public function testGetNameFor( $componentName, $componentClass ) { |
||
214 | |||
215 | /** |
||
216 | * @param bool|string[] $whiteList |
||
217 | * @param string[] $expectedComponents |
||
218 | * |
||
219 | * @throws \ConfigException |
||
220 | * |
||
221 | * @dataProvider whiteListProvider |
||
222 | */ |
||
223 | public function testSetWhiteList( $whiteList, $expectedComponents ) { |
||
230 | |||
231 | /** |
||
232 | * @param string $method |
||
233 | * |
||
234 | * @throws \ConfigException |
||
235 | * |
||
236 | * @expectedException \MWException |
||
237 | * |
||
238 | * @dataProvider exceptionThrowingMethodsProvider |
||
239 | */ |
||
240 | public function testFails( $method ) { |
||
247 | |||
248 | /** |
||
249 | * @throws \ConfigException |
||
250 | */ |
||
251 | public function testRegisterVsKnown() { |
||
272 | |||
273 | /** |
||
274 | * @throws \ConfigException |
||
275 | * |
||
276 | * @expectedException \MWException |
||
277 | */ |
||
278 | public function testUnknownComponentName() { |
||
284 | |||
285 | /** |
||
286 | * @throws \ConfigException |
||
287 | * |
||
288 | * @expectedException \MWException |
||
289 | */ |
||
290 | public function testUnknownComponentClass() { |
||
296 | |||
297 | /** |
||
298 | * @return array |
||
299 | */ |
||
300 | public function compileParserHookStringProvider() { |
||
318 | |||
319 | /** |
||
320 | * @return array[] |
||
321 | */ |
||
322 | public function componentNameAndClassProvider() { |
||
340 | |||
341 | /** |
||
342 | * @return array |
||
343 | */ |
||
344 | public function componentAliasesProvider() { |
||
352 | |||
353 | /** |
||
354 | * @return array |
||
355 | */ |
||
356 | public function componentAttributesProvider() { |
||
363 | |||
364 | /** |
||
365 | * @return array[] |
||
366 | */ |
||
367 | public function exceptionThrowingMethodsProvider() { |
||
374 | |||
375 | /** |
||
376 | * @return array |
||
377 | */ |
||
378 | public function handlerTypeProvider() { |
||
387 | |||
388 | /** |
||
389 | * @return array[] |
||
390 | */ |
||
391 | public function modulesForComponentsProvider() { |
||
445 | |||
446 | /** |
||
447 | * @return array |
||
448 | */ |
||
449 | public function whiteListProvider() { |
||
475 | } |
||
476 |
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.