Index: trunk/phase3/tests/phpunit/includes/MWNamespaceTest.php |
— | — | @@ -276,15 +276,26 @@ |
277 | 277 | $this->assertFalse( MWNamespace::hasSubpages( NS_SPECIAL ) ); |
278 | 278 | |
279 | 279 | // namespaces without subpages |
| 280 | + # save up global |
280 | 281 | global $wgNamespacesWithSubpages; |
281 | | - if( array_key_exists( NS_MAIN, $wgNamespacesWithSubpages ) |
282 | | - && $wgNamespacesWithSubpages[NS_MAIN] === true |
283 | | - ) { |
284 | | - $this->markTestSkipped( "Main namespace has subpages enabled" ); |
285 | | - } else { |
286 | | - $this->assertFalse( MWNamespace::hasSubpages( NS_MAIN ) ); |
| 282 | + $saved = null; |
| 283 | + if( array_key_exists( NS_MAIN, $wgNamespacesWithSubpages ) ) { |
| 284 | + $saved = $wgNamespacesWithSubpages[NS_MAIN]; |
| 285 | + unset( $wgNamespacesWithSubpages[NS_MAIN] ); |
287 | 286 | } |
288 | 287 | |
| 288 | + $this->assertFalse( MWNamespace::hasSubpages( NS_MAIN ) ); |
| 289 | + |
| 290 | + $wgNamespacesWithSubpages[NS_MAIN] = true; |
| 291 | + $this->assertTrue( MWNamespace::hasSubpages( NS_MAIN ) ); |
| 292 | + $wgNamespacesWithSubpages[NS_MAIN] = false; |
| 293 | + $this->assertFalse( MWNamespace::hasSubpages( NS_MAIN ) ); |
| 294 | + |
| 295 | + # restore global |
| 296 | + if( $saved !== null ) { |
| 297 | + $wgNamespacesWithSubpages[NS_MAIN] = $saved; |
| 298 | + } |
| 299 | + |
289 | 300 | // Some namespaces with subpages |
290 | 301 | $this->assertTrue( MWNamespace::hasSubpages( NS_TALK ) ); |
291 | 302 | $this->assertTrue( MWNamespace::hasSubpages( NS_USER ) ); |