summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/MWNamespaceTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/phpunit/includes/MWNamespaceTest.php')
-rw-r--r--tests/phpunit/includes/MWNamespaceTest.php43
1 files changed, 39 insertions, 4 deletions
diff --git a/tests/phpunit/includes/MWNamespaceTest.php b/tests/phpunit/includes/MWNamespaceTest.php
index 6b231fc5..3b05d675 100644
--- a/tests/phpunit/includes/MWNamespaceTest.php
+++ b/tests/phpunit/includes/MWNamespaceTest.php
@@ -53,10 +53,6 @@ class MWNamespaceTest extends MediaWikiTestCase {
$this->assertIsNotSubject( NS_TALK );
$this->assertIsNotSubject( NS_USER_TALK );
$this->assertIsNotSubject( 101 ); # user defined
-
- // Back compat
- $this->assertTrue( MWNamespace::isMain( NS_MAIN ) == MWNamespace::isSubject( NS_MAIN ) );
- $this->assertTrue( MWNamespace::isMain( NS_USER_TALK ) == MWNamespace::isSubject( NS_USER_TALK ) );
}
/**
@@ -442,6 +438,36 @@ class MWNamespaceTest extends MediaWikiTestCase {
}
/**
+ */
+ public function testGetSubjectNamespaces() {
+ $subjectsNS = MWNamespace::getSubjectNamespaces();
+ $this->assertContains( NS_MAIN, $subjectsNS,
+ "Talk namespaces should have NS_MAIN" );
+ $this->assertNotContains( NS_TALK, $subjectsNS,
+ "Talk namespaces should have NS_TALK" );
+
+ $this->assertNotContains( NS_MEDIA, $subjectsNS,
+ "Talk namespaces should not have NS_MEDIA" );
+ $this->assertNotContains( NS_SPECIAL, $subjectsNS,
+ "Talk namespaces should not have NS_SPECIAL" );
+ }
+
+ /**
+ */
+ public function testGetTalkNamespaces() {
+ $talkNS = MWNamespace::getTalkNamespaces();
+ $this->assertContains( NS_TALK, $talkNS,
+ "Subject namespaces should have NS_TALK" );
+ $this->assertNotContains( NS_MAIN, $talkNS,
+ "Subject namespaces should not have NS_MAIN" );
+
+ $this->assertNotContains( NS_MEDIA, $talkNS,
+ "Subject namespaces should not have NS_MEDIA" );
+ $this->assertNotContains( NS_SPECIAL, $talkNS,
+ "Subject namespaces should not have NS_SPECIAL" );
+ }
+
+ /**
* Some namespaces are always capitalized per code definition
* in MWNamespace::$alwaysCapitalizedNamespaces
*/
@@ -550,6 +576,15 @@ class MWNamespaceTest extends MediaWikiTestCase {
}
+ public function testIsNonincludable() {
+ global $wgNonincludableNamespaces;
+ $wgNonincludableNamespaces = array( NS_USER );
+
+ $this->assertTrue( MWNamespace::isNonincludable( NS_USER ) );
+
+ $this->assertFalse( MWNamespace::isNonincludable( NS_TEMPLATE ) );
+ }
+
####### HELPERS ###########################################################
function __call( $method, $args ) {
// Call the real method if it exists