Go to the documentation of this file.
21 'wgNamespacesWithSubpages' =>
array(
26 'wgCapitalLinks' =>
true,
27 'wgCapitalLinkOverrides' =>
array(),
28 'wgNonincludableNamespaces' =>
array(),
32 #### START OF TESTS #########################################################
40 # @todo FIXME: Write more tests!!
53 $this->assertIsSubject(
NS_MAIN );
54 $this->assertIsSubject(
NS_USER );
55 $this->assertIsSubject( 100 ); #
user defined
58 $this->assertIsNotSubject(
NS_TALK );
60 $this->assertIsNotSubject( 101 ); #
user defined
74 $this->assertIsNotTalk(
NS_MAIN );
75 $this->assertIsNotTalk(
NS_USER );
76 $this->assertIsNotTalk( 100 ); #
user defined
81 $this->assertIsTalk( 101 ); #
user defined
140 ### Exceptions with getAssociated()
141 ### NS_MEDIA and NS_SPECIAL do not have talk pages. MediaWiki raises
142 ### an exception for them.
213 "NS_MEDIA and NS_SPECIAL are different subject namespaces"
217 "NS_SPECIAL and NS_MEDIA are different subject namespaces"
271 $this->assertCanNotTalk(
NS_MEDIA );
274 $this->assertCanTalk(
NS_MAIN );
275 $this->assertCanTalk(
NS_TALK );
276 $this->assertCanTalk(
NS_USER );
280 $this->assertCanTalk( 100 );
281 $this->assertCanTalk( 101 );
291 $this->assertIsContent(
NS_MAIN );
295 $this->assertIsNotContent(
NS_MEDIA );
297 $this->assertIsNotContent(
NS_TALK );
298 $this->assertIsNotContent(
NS_USER );
300 $this->assertIsNotContent( 100 );
309 global $wgContentNamespaces;
312 $this->assertIsNotContent( 252 );
315 $wgContentNamespaces[] = 252;
317 $this->assertIsContent( 252 );
320 $this->assertIsContent(
NS_MAIN );
328 $this->assertIsNotWatchable(
NS_MEDIA );
332 $this->assertIsWatchable(
NS_MAIN );
333 $this->assertIsWatchable(
NS_TALK );
336 $this->assertIsWatchable( 100 );
337 $this->assertIsWatchable( 101 );
344 global $wgNamespacesWithSubpages;
347 $this->assertHasNotSubpages(
NS_MEDIA );
351 $this->assertHasNotSubpages(
NS_MAIN );
353 $wgNamespacesWithSubpages[
NS_MAIN] =
true;
354 $this->assertHasSubpages(
NS_MAIN );
356 $wgNamespacesWithSubpages[
NS_MAIN] =
false;
357 $this->assertHasNotSubpages(
NS_MAIN );
360 $this->assertHasSubpages(
NS_TALK );
361 $this->assertHasSubpages(
NS_USER );
369 global $wgContentNamespaces;
374 '$wgContentNamespaces is an array with only NS_MAIN by default'
377 # test !is_array( $wgcontentNamespaces )
378 $wgContentNamespaces =
'';
381 $wgContentNamespaces =
false;
384 $wgContentNamespaces =
null;
387 $wgContentNamespaces = 5;
390 # test $wgContentNamespaces === array()
391 $wgContentNamespaces =
array();
394 # test !in_array( NS_MAIN, $wgContentNamespaces )
399 'NS_MAIN is forced in $wgContentNamespaces even if unwanted'
402 # test other cases, return $wgcontentNamespaces as is
421 $this->assertContains(
NS_MAIN, $subjectsNS,
422 "Talk namespaces should have NS_MAIN" );
423 $this->assertNotContains(
NS_TALK, $subjectsNS,
424 "Talk namespaces should have NS_TALK" );
426 $this->assertNotContains(
NS_MEDIA, $subjectsNS,
427 "Talk namespaces should not have NS_MEDIA" );
428 $this->assertNotContains(
NS_SPECIAL, $subjectsNS,
429 "Talk namespaces should not have NS_SPECIAL" );
437 $this->assertContains(
NS_TALK, $talkNS,
438 "Subject namespaces should have NS_TALK" );
439 $this->assertNotContains(
NS_MAIN, $talkNS,
440 "Subject namespaces should not have NS_MAIN" );
442 $this->assertNotContains(
NS_MEDIA, $talkNS,
443 "Subject namespaces should not have NS_MEDIA" );
444 $this->assertNotContains(
NS_SPECIAL, $talkNS,
445 "Subject namespaces should not have NS_SPECIAL" );
458 'NS_MEDIA and NS_FILE have same capitalization rendering'
462 $this->assertIsCapitalized(
NS_MEDIA );
463 $this->assertIsCapitalized(
NS_FILE );
468 $this->assertIsCapitalized(
NS_USER );
491 $wgCapitalLinks =
false;
495 $this->assertIsCapitalized(
NS_USER );
511 global $wgCapitalLinkOverrides;
519 $this->assertIsCapitalized(
NS_USER );
524 $wgCapitalLinkOverrides[
NS_USER] =
false;
528 $this->assertIsCapitalized(
NS_USER );
560 global $wgNonincludableNamespaces;
568 ####### HELPERS ###########################################################
571 if ( method_exists( $this, $method ) ) {
572 return $this->$method(
$args );
575 if ( preg_match(
'/^assert(Has|Is|Can)(Not|)(Subject|Talk|Watchable|Content|Subpages|Capitalized)$/', $method, $m ) ) {
576 # Interprets arguments:
578 $msg = isset(
$args[1] ) ?
$args[1] :
" dummy message";
580 # Forge the namespace constant name:
582 $ns_name =
"NS_MAIN";
586 # ... and the MWNamespace method name
587 $nsMethod = strtolower( $m[1] ) . $m[3];
589 $expect = ( $m[2] ===
'' );
590 $expect_name = $expect ?
'TRUE' :
'FALSE';
592 return $this->assertEquals( $expect,
593 MWNamespace::$nsMethod( $ns, $msg ),
594 "MWNamespace::$nsMethod( $ns_name ) should returns $expect_name"
598 throw new Exception( __METHOD__ .
" could not find a method named $method\n" );
testIsContentAdvanced()
Similar to testIsContent() but alters the $wgContentNamespaces global variable.
testSubjectEquals()
@covers MWNamespace::subjectEquals
static subjectEquals( $ns1, $ns2)
Returns whether the specified namespaces share the same subject.
static isNonincludable( $index)
It is not possible to use pages from this namespace as template?
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
assertDifferentSubject( $ns1, $ns2, $msg='')
static hasGenderDistinction( $index)
Does the namespace (potentially) have different aliases for different genders.
static getTalkNamespaces()
List all namespace indices which are considered talks, aka not a subject or special namespace.
testGetSubjectNamespaces()
@covers MWNamespace::getSubjectNamespaces
testGetAssociated()
Regular getAssociated() calls Namespaces without an associated page (NS_MEDIA, NS_SPECIAL) are tested...
testGetContentNamespaces()
@covers MWNamespace::getContentNamespaces
testIsNonincludable()
@covers MWNamespace::isNonincludable
testIsSubject()
Please make sure to change testIsTalk() if you change the assertions below @covers MWNamespace::isSub...
testGetSubject()
@covers MWNamespace::getSubject
testIsCapitalizedWithWgCapitalLinks()
Follows up for testIsCapitalizedHardcodedAssertions() but alter the global $wgCapitalLink setting to ...
static getSubjectNamespaces()
List all namespace indices which are considered subject, aka not a talk or special namespace.
testSpecialAndMediaAreDifferentSubjects()
@covers MWNamespace::subjectEquals
static getContentNamespaces()
Get a list of all namespace indices which are considered to contain content.
Test class for MWNamespace.
testIsTalk()
Reverse of testIsSubject().
testCanTalk()
@covers MWNamespace::canTalk
testGetTalkNamespaces()
@covers MWNamespace::getTalkNamespaces
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
testIsWatchable()
@covers MWNamespace::isWatchable
static isMovable( $index)
Can pages in the given namespace be moved?
when a variable name is used in a it is silently declared as a new masking the global
assertSameSubject( $ns1, $ns2, $msg='')
testEquals()
Test MWNamespace::equals Note if we add a namespace registration system with keys like 'MAIN' we shou...
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
testGetAssociatedExceptionsForNsMedia()
@expectedException MWException @covers MWNamespace::getAssociated
testIsCapitalizedHardcodedAssertions()
Some namespaces are always capitalized per code definition in MWNamespace::$alwaysCapitalizedNamespac...
testGetTalkExceptionsForNsMedia()
Exceptions with getTalk() NS_MEDIA does not have talk pages.
testIsCapitalizedWithWgCapitalLinkOverrides()
Counter part for MWNamespace::testIsCapitalizedWithWgCapitalLinks() now testing the $wgCapitalLinkOve...
testGetTalkExceptionsForNsSpecial()
Exceptions with getTalk() NS_SPECIAL does not have talk pages.
static equals( $ns1, $ns2)
Returns whether the specified namespaces are the same namespace.
static isCapitalized( $index)
Is the namespace first-letter capitalized?
testHasSubpages()
@covers MWNamespace::hasSubpages
static getTalk( $index)
Get the talk namespace index for a given namespace.
testGetTalk()
Regular getTalk() calls Namespaces without a talk page (NS_MEDIA, NS_SPECIAL) are tested in the funct...
static getSubject( $index)
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA,...
testGetAssociatedExceptionsForNsSpecial()
@expectedException MWException @covers MWNamespace::getAssociated
testIsContent()
@covers MWNamespace::isContent
static getAssociated( $index)
Get the associated namespace.
static getCanonicalName( $index)
Returns the canonical (English) name for a given index.
testHasGenderDistinction()
@covers MWNamespace::hasGenderDistinction