14 'wgContentNamespaces' => [
NS_MAIN ],
15 'wgNamespacesWithSubpages' => [
20 'wgCapitalLinks' =>
true,
21 'wgCapitalLinkOverrides' => [],
22 'wgNonincludableNamespaces' => [],
31 $this->assertFalse( MWNamespace::isMovable(
NS_SPECIAL ) );
35 $this->assertTrue( MWNamespace::isSubject( $ns ) );
39 $this->assertFalse( MWNamespace::isSubject( $ns ) );
63 $this->assertTrue( MWNamespace::isTalk( $ns ) );
67 $this->assertFalse( MWNamespace::isTalk( $ns ) );
99 $this->assertEquals(
NS_MAIN, MWNamespace::getSubject(
NS_TALK ) );
100 $this->assertEquals( NS_USER, MWNamespace::getSubject(
NS_USER_TALK ) );
112 $this->assertEquals(
NS_USER_TALK, MWNamespace::getTalk( NS_USER ) );
123 $this->assertNull( MWNamespace::getTalk(
NS_MEDIA ) );
133 $this->assertNull( MWNamespace::getTalk(
NS_SPECIAL ) );
143 $this->assertEquals(
NS_TALK, MWNamespace::getAssociated(
NS_MAIN ) );
144 $this->assertEquals(
NS_MAIN, MWNamespace::getAssociated(
NS_TALK ) );
147 # ## Exceptions with getAssociated()
148 # ## NS_MEDIA and NS_SPECIAL do not have talk pages. MediaWiki raises
149 # ## an exception for them.
155 $this->assertNull( MWNamespace::getAssociated(
NS_MEDIA ) );
163 $this->assertNull( MWNamespace::getAssociated(
NS_SPECIAL ) );
175 $this->assertTrue( MWNamespace::equals(
NS_MAIN, 0 ) );
176 $this->assertTrue( MWNamespace::equals( NS_USER, NS_USER ) );
177 $this->assertTrue( MWNamespace::equals( NS_USER, 2 ) );
181 $this->assertFalse( MWNamespace::equals( NS_USER,
NS_USER_TALK ) );
208 "NS_MEDIA and NS_SPECIAL are different subject namespaces"
212 "NS_SPECIAL and NS_MEDIA are different subject namespaces"
239 $actual = MWNamespace::hasTalkNamespace( $index );
240 $this->assertSame( $actual, $expected,
"NS $index" );
251 $actual = MWNamespace::canTalk( $index );
252 $this->assertSame( $actual, $expected,
"NS $index" );
256 $this->assertTrue( MWNamespace::isContent( $ns ) );
260 $this->assertFalse( MWNamespace::isContent( $ns ) );
294 $wgContentNamespaces[] = 252;
303 $this->assertTrue( MWNamespace::isWatchable( $ns ) );
307 $this->assertFalse( MWNamespace::isWatchable( $ns ) );
328 $this->assertTrue( MWNamespace::hasSubpages( $ns ) );
332 $this->assertFalse( MWNamespace::hasSubpages( $ns ) );
348 $wgNamespacesWithSubpages[
NS_MAIN] =
true;
351 $wgNamespacesWithSubpages[
NS_MAIN] =
false;
368 MWNamespace::getContentNamespaces(),
369 '$wgContentNamespaces is an array with only NS_MAIN by default'
372 # test !is_array( $wgcontentNamespaces )
374 $this->assertEquals( [
NS_MAIN ], MWNamespace::getContentNamespaces() );
377 $this->assertEquals( [
NS_MAIN ], MWNamespace::getContentNamespaces() );
380 $this->assertEquals( [
NS_MAIN ], MWNamespace::getContentNamespaces() );
383 $this->assertEquals( [
NS_MAIN ], MWNamespace::getContentNamespaces() );
385 # test $wgContentNamespaces === []
387 $this->assertEquals( [
NS_MAIN ], MWNamespace::getContentNamespaces() );
389 # test !in_array( NS_MAIN, $wgContentNamespaces )
393 MWNamespace::getContentNamespaces(),
394 'NS_MAIN is forced in $wgContentNamespaces even if unwanted'
397 # test other cases, return $wgcontentNamespaces as is
401 MWNamespace::getContentNamespaces()
407 MWNamespace::getContentNamespaces()
415 $subjectsNS = MWNamespace::getSubjectNamespaces();
416 $this->assertContains(
NS_MAIN, $subjectsNS,
417 "Talk namespaces should have NS_MAIN" );
418 $this->assertNotContains(
NS_TALK, $subjectsNS,
419 "Talk namespaces should have NS_TALK" );
421 $this->assertNotContains(
NS_MEDIA, $subjectsNS,
422 "Talk namespaces should not have NS_MEDIA" );
423 $this->assertNotContains(
NS_SPECIAL, $subjectsNS,
424 "Talk namespaces should not have NS_SPECIAL" );
431 $talkNS = MWNamespace::getTalkNamespaces();
432 $this->assertContains(
NS_TALK, $talkNS,
433 "Subject namespaces should have NS_TALK" );
434 $this->assertNotContains(
NS_MAIN, $talkNS,
435 "Subject namespaces should not have NS_MAIN" );
437 $this->assertNotContains(
NS_MEDIA, $talkNS,
438 "Subject namespaces should not have NS_MEDIA" );
439 $this->assertNotContains(
NS_SPECIAL, $talkNS,
440 "Subject namespaces should not have NS_SPECIAL" );
444 $this->assertTrue( MWNamespace::isCapitalized( $ns ) );
448 $this->assertFalse( MWNamespace::isCapitalized( $ns ) );
459 MWNamespace::isCapitalized(
NS_MEDIA ),
460 MWNamespace::isCapitalized(
NS_FILE ),
461 'NS_MEDIA and NS_FILE have same capitalization rendering'
494 $wgCapitalLinks =
false;
549 $this->assertTrue( MWNamespace::hasGenderDistinction( NS_USER ) );
550 $this->assertTrue( MWNamespace::hasGenderDistinction(
NS_USER_TALK ) );
553 $this->assertFalse( MWNamespace::hasGenderDistinction(
NS_MEDIA ) );
554 $this->assertFalse( MWNamespace::hasGenderDistinction(
NS_SPECIAL ) );
555 $this->assertFalse( MWNamespace::hasGenderDistinction(
NS_MAIN ) );
556 $this->assertFalse( MWNamespace::hasGenderDistinction(
NS_TALK ) );
567 $this->assertTrue( MWNamespace::isNonincludable( NS_USER ) );
568 $this->assertFalse( MWNamespace::isNonincludable(
NS_TEMPLATE ) );
572 $this->assertTrue( MWNamespace::subjectEquals( $ns1, $ns2 ), $msg );
576 $this->assertFalse( MWNamespace::subjectEquals( $ns1, $ns2 ), $msg );
605 $actual = MWNamespace::getCategoryLinkType( $index );
606 $this->assertSame( $expected, $actual,
"NS $index" );
$wgNamespacesWithSubpages
Which namespaces should support subpages? See Language.php for a list of namespaces.
$wgCapitalLinks
Set this to false to avoid forcing the first letter of links to capitals.
$wgNonincludableNamespaces
Pages in namespaces in this array can not be used as templates.
$wgContentNamespaces
Array of namespaces which can be deemed to contain valid "content", as far as the site statistics are...
assertIsCapitalized( $ns)
testHasGenderDistinction()
MWNamespace::hasGenderDistinction.
testGetTalkNamespaces()
MWNamespace::getTalkNamespaces.
assertDifferentSubject( $ns1, $ns2, $msg='')
testGetAssociatedExceptionsForNsSpecial()
MWException MWNamespace::getAssociated.
testSubjectEquals()
MWNamespace::subjectEquals.
testGetTalk()
Regular getTalk() calls Namespaces without a talk page (NS_MEDIA, NS_SPECIAL) are tested in the funct...
testHasSubpages()
MWNamespace::hasSubpages.
testHasTalkNamespace( $index, $expected)
provideHasTalkNamespace MWNamespace::hasTalkNamespace
testIsWatchable()
MWNamespace::isWatchable.
testIsContentAdvanced()
Similar to testIsContent() but alters the $wgContentNamespaces global variable.
testGetContentNamespaces()
MWNamespace::getContentNamespaces.
testGetAssociated()
Regular getAssociated() calls Namespaces without an associated page (NS_MEDIA, NS_SPECIAL) are tested...
provideHasTalkNamespace()
testIsCapitalizedWithWgCapitalLinks()
Follows up for testIsCapitalizedHardcodedAssertions() but alter the global $wgCapitalLink setting to ...
testGetTalkExceptionsForNsSpecial()
Exceptions with getTalk() NS_SPECIAL does not have talk pages.
testGetSubject()
MWNamespace::getSubject.
testIsCapitalizedHardcodedAssertions()
Some namespaces are always capitalized per code definition in MWNamespace::$alwaysCapitalizedNamespac...
testGetCategoryLinkType( $index, $expected)
provideGetCategoryLinkType MWNamespace::getCategoryLinkType
testGetAssociatedExceptionsForNsMedia()
MWException MWNamespace::getAssociated.
testEquals()
Test MWNamespace::equals Note if we add a namespace registration system with keys like 'MAIN' we shou...
assertIsNotWatchable( $ns)
testIsNonincludable()
MWNamespace::isNonincludable.
assertHasNotSubpages( $ns)
testGetSubjectNamespaces()
MWNamespace::getSubjectNamespaces.
testIsCapitalizedWithWgCapitalLinkOverrides()
Counter part for MWNamespace::testIsCapitalizedWithWgCapitalLinks() now testing the $wgCapitalLinkOve...
assertSameSubject( $ns1, $ns2, $msg='')
testIsTalk()
Reverse of testIsSubject().
assertIsNotCapitalized( $ns)
testSpecialAndMediaAreDifferentSubjects()
MWNamespace::subjectEquals.
provideGetCategoryLinkType()
testCanTalk( $index, $expected)
provideHasTalkNamespace MWNamespace::canTalk
testGetTalkExceptionsForNsMedia()
Exceptions with getTalk() NS_MEDIA does not have talk pages.
testIsContent()
MWNamespace::isContent.
testIsSubject()
Please make sure to change testIsTalk() if you change the assertions below MWNamespace::isSubject.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
processing should stop and the error should be shown to the user * false