From 30dff024244dc68d74db74b9c20b239767c49ab6 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Wed, 24 Aug 2011 20:14:03 +0000 Subject: [PATCH] Fixup the rest of r82577 --- tests/phpunit/includes/MWNamespaceTest.php | 41 +++++++++++++++++++--- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/tests/phpunit/includes/MWNamespaceTest.php b/tests/phpunit/includes/MWNamespaceTest.php index 8b36fe5ecf..b3be3415c7 100644 --- a/tests/phpunit/includes/MWNamespaceTest.php +++ b/tests/phpunit/includes/MWNamespaceTest.php @@ -219,14 +219,45 @@ class MWNamespaceTest extends MediaWikiTestCase { // and per function definition. $this->assertTrue( MWNamespace::isContent( NS_MAIN ) ); + global $wgContentNamespaces; + + $saved = $wgContentNamespaces; + + $wgContentNamespaces[] = NS_MAIN; + $this->assertTrue( MWNamespace::isContent( NS_MAIN ) ); + // Other namespaces which are not expected to be content - $this->assertFalse( MWNamespace::isContent( NS_MEDIA ) ); - $this->assertFalse( MWNamespace::isContent( NS_SPECIAL ) ); - $this->assertFalse( MWNamespace::isContent( NS_TALK ) ); - $this->assertFalse( MWNamespace::isContent( NS_USER ) ); + if ( isset( $wgContentNamespaces[NS_MEDIA] ) ) { + unset( $wgContentNamespaces[NS_MEDIA] ); + } + $this->assertFalse( MWNamespace::isContent( NS_MEDIA ) ); + + if ( isset( $wgContentNamespaces[NS_SPECIAL] ) ) { + unset( $wgContentNamespaces[NS_SPECIAL] ); + } + $this->assertFalse( MWNamespace::isContent( NS_SPECIAL ) ); + + if ( isset( $wgContentNamespaces[NS_TALK] ) ) { + unset( $wgContentNamespaces[NS_TALK] ); + } + $this->assertFalse( MWNamespace::isContent( NS_TALK ) ); + + if ( isset( $wgContentNamespaces[NS_USER] ) ) { + unset( $wgContentNamespaces[NS_USER] ); + } + $this->assertFalse( MWNamespace::isContent( NS_USER ) ); + + if ( isset( $wgContentNamespaces[NS_CATEGORY] ) ) { + unset( $wgContentNamespaces[NS_CATEGORY] ); + } $this->assertFalse( MWNamespace::isContent( NS_CATEGORY ) ); - // User defined namespace: + + if ( isset( $wgContentNamespaces[100] ) ) { + unset( $wgContentNamespaces[100] ); + } $this->assertFalse( MWNamespace::isContent( 100 ) ); + + $wgContentNamespaces = saved; } /** -- 2.20.1