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 ) );
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 ) );
177 $this->assertTrue( MWNamespace::equals(
NS_USER, 2 ) );
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" );
252 $actual = MWNamespace::canTalk( $index );
253 $this->assertSame( $actual, $expected,
"NS $index" );
257 $this->assertTrue( MWNamespace::isContent( $ns ) );
261 $this->assertFalse( MWNamespace::isContent( $ns ) );
295 $wgContentNamespaces[] = 252;
304 $this->assertTrue( MWNamespace::isWatchable( $ns ) );
308 $this->assertFalse( MWNamespace::isWatchable( $ns ) );
329 $this->assertTrue( MWNamespace::hasSubpages( $ns ) );
333 $this->assertFalse( MWNamespace::hasSubpages( $ns ) );
349 $wgNamespacesWithSubpages[
NS_MAIN] =
true;
352 $wgNamespacesWithSubpages[
NS_MAIN] =
false;
369 MWNamespace::getContentNamespaces(),
370 '$wgContentNamespaces is an array with only NS_MAIN by default'
373 # test !is_array( $wgcontentNamespaces )
375 $this->assertEquals( [
NS_MAIN ], MWNamespace::getContentNamespaces() );
378 $this->assertEquals( [
NS_MAIN ], MWNamespace::getContentNamespaces() );
381 $this->assertEquals( [
NS_MAIN ], MWNamespace::getContentNamespaces() );
384 $this->assertEquals( [
NS_MAIN ], MWNamespace::getContentNamespaces() );
386 # test $wgContentNamespaces === []
388 $this->assertEquals( [
NS_MAIN ], MWNamespace::getContentNamespaces() );
390 # test !in_array( NS_MAIN, $wgContentNamespaces )
394 MWNamespace::getContentNamespaces(),
395 'NS_MAIN is forced in $wgContentNamespaces even if unwanted'
398 # test other cases, return $wgcontentNamespaces as is
402 MWNamespace::getContentNamespaces()
408 MWNamespace::getContentNamespaces()
416 $subjectsNS = MWNamespace::getSubjectNamespaces();
417 $this->assertContains(
NS_MAIN, $subjectsNS,
418 "Talk namespaces should have NS_MAIN" );
419 $this->assertNotContains(
NS_TALK, $subjectsNS,
420 "Talk namespaces should have NS_TALK" );
422 $this->assertNotContains(
NS_MEDIA, $subjectsNS,
423 "Talk namespaces should not have NS_MEDIA" );
424 $this->assertNotContains(
NS_SPECIAL, $subjectsNS,
425 "Talk namespaces should not have NS_SPECIAL" );
432 $talkNS = MWNamespace::getTalkNamespaces();
433 $this->assertContains(
NS_TALK, $talkNS,
434 "Subject namespaces should have NS_TALK" );
435 $this->assertNotContains(
NS_MAIN, $talkNS,
436 "Subject namespaces should not have NS_MAIN" );
438 $this->assertNotContains(
NS_MEDIA, $talkNS,
439 "Subject namespaces should not have NS_MEDIA" );
440 $this->assertNotContains(
NS_SPECIAL, $talkNS,
441 "Subject namespaces should not have NS_SPECIAL" );
445 $this->assertTrue( MWNamespace::isCapitalized( $ns ) );
449 $this->assertFalse( MWNamespace::isCapitalized( $ns ) );
460 MWNamespace::isCapitalized(
NS_MEDIA ),
461 MWNamespace::isCapitalized(
NS_FILE ),
462 'NS_MEDIA and NS_FILE have same capitalization rendering'
495 $wgCapitalLinks =
false;
550 $this->assertTrue( MWNamespace::hasGenderDistinction(
NS_USER ) );
551 $this->assertTrue( MWNamespace::hasGenderDistinction(
NS_USER_TALK ) );
554 $this->assertFalse( MWNamespace::hasGenderDistinction(
NS_MEDIA ) );
555 $this->assertFalse( MWNamespace::hasGenderDistinction(
NS_SPECIAL ) );
556 $this->assertFalse( MWNamespace::hasGenderDistinction(
NS_MAIN ) );
557 $this->assertFalse( MWNamespace::hasGenderDistinction(
NS_TALK ) );
568 $this->assertTrue( MWNamespace::isNonincludable(
NS_USER ) );
569 $this->assertFalse( MWNamespace::isNonincludable(
NS_TEMPLATE ) );
573 $this->assertTrue( MWNamespace::subjectEquals( $ns1, $ns2 ), $msg );
577 $this->assertFalse( MWNamespace::subjectEquals( $ns1, $ns2 ), $msg );
606 $actual = MWNamespace::getCategoryLinkType( $index );
607 $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.
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same user
Wikitext formatted, in the key only.
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
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php