Index: trunk/phase3/tests/phpunit/includes/HtmlTest.php |
— | — | @@ -265,19 +265,12 @@ |
266 | 266 | ), |
267 | 267 | 'Basic namespace selector with custom values' |
268 | 268 | ); |
269 | | - $immovable = array(); |
270 | | - $namespaces = $wgContLang->getNamespaces(); |
271 | | - foreach ( $namespaces as $nsId => $nsName ) { |
272 | | - if ( !MWNamespace::isMovable( intval( $nsId ) ) ) { |
273 | | - $immovable[] = $nsId; |
274 | | - } |
275 | 269 | } |
276 | | - $this->assertEquals( |
277 | | - '<select id="namespace" name="namespace">' . "\n" . |
278 | | -'<option value="0">(Main)</option>' . "\n" . |
279 | | -'<option value="1">Talk</option>' . "\n" . |
| 270 | + |
| 271 | + function testCanFilterOutNamespaces() { |
| 272 | + $this->assertEquals( |
| 273 | +'<select id="namespace" name="namespace">' . "\n" . |
280 | 274 | '<option value="2">User</option>' . "\n" . |
281 | | -'<option value="3">User talk</option>' . "\n" . |
282 | 275 | '<option value="4">MyWiki</option>' . "\n" . |
283 | 276 | '<option value="5">MyWiki Talk</option>' . "\n" . |
284 | 277 | '<option value="6">File</option>' . "\n" . |
— | — | @@ -286,14 +279,41 @@ |
287 | 280 | '<option value="9">MediaWiki talk</option>' . "\n" . |
288 | 281 | '<option value="10">Template</option>' . "\n" . |
289 | 282 | '<option value="11">Template talk</option>' . "\n" . |
290 | | -'<option disabled="" value="14">Category</option>' . "\n" . |
| 283 | +'<option value="14">Category</option>' . "\n" . |
291 | 284 | '<option value="15">Category talk</option>' . "\n" . |
292 | 285 | '</select>', |
293 | 286 | Html::namespaceSelector( |
294 | | - array( 'exclude' => array( 100, 101 ), 'disable' => $immovable ) |
| 287 | + array( 'exclude' => array( 0, 1, 3, 100, 101 ) ) |
295 | 288 | ), |
296 | | - 'Namespace selector without the custom namespace and immovable namespaces disabled.' |
| 289 | + 'Namespace selector namespace filtering.' |
297 | 290 | ); |
| 291 | + } |
| 292 | + |
| 293 | + function testCanDisableANamespaces() { |
| 294 | + $this->assertEquals( |
| 295 | +'<select id="namespace" name="namespace">' . "\n" . |
| 296 | +'<option disabled="" value="0">(Main)</option>' . "\n" . |
| 297 | +'<option disabled="" value="1">Talk</option>' . "\n" . |
| 298 | +'<option disabled="" value="2">User</option>' . "\n" . |
| 299 | +'<option disabled="" value="3">User talk</option>' . "\n" . |
| 300 | +'<option disabled="" value="4">MyWiki</option>' . "\n" . |
| 301 | +'<option value="5">MyWiki Talk</option>' . "\n" . |
| 302 | +'<option value="6">File</option>' . "\n" . |
| 303 | +'<option value="7">File talk</option>' . "\n" . |
| 304 | +'<option value="8">MediaWiki</option>' . "\n" . |
| 305 | +'<option value="9">MediaWiki talk</option>' . "\n" . |
| 306 | +'<option value="10">Template</option>' . "\n" . |
| 307 | +'<option value="11">Template talk</option>' . "\n" . |
| 308 | +'<option value="14">Category</option>' . "\n" . |
| 309 | +'<option value="15">Category talk</option>' . "\n" . |
| 310 | +'<option value="100">Custom</option>' . "\n" . |
| 311 | +'<option value="101">Custom talk</option>' . "\n" . |
| 312 | +'</select>', |
| 313 | + Html::namespaceSelector( array( |
| 314 | + 'disable' => array( 0, 1, 2, 3, 4 ) |
| 315 | + ) ), |
| 316 | + 'Namespace selector namespace disabling' |
| 317 | + ); |
298 | 318 | } |
299 | 319 | |
300 | 320 | function testNamespaceSelectorIdAndNameDefaultsAttributes() { |