MediaWiki  1.30.0
MWNamespaceTest.php
Go to the documentation of this file.
1 <?php
14  protected function setUp() {
15  parent::setUp();
16 
17  $this->setMwGlobals( [
18  'wgContentNamespaces' => [ NS_MAIN ],
19  'wgNamespacesWithSubpages' => [
20  NS_TALK => true,
21  NS_USER => true,
22  NS_USER_TALK => true,
23  ],
24  'wgCapitalLinks' => true,
25  'wgCapitalLinkOverrides' => [],
26  'wgNonincludableNamespaces' => [],
27  ] );
28  }
29 
30 # ### START OF TESTS #########################################################
31 
36  public function testIsMovable() {
37  $this->assertFalse( MWNamespace::isMovable( NS_SPECIAL ) );
38  # @todo FIXME: Write more tests!!
39  }
40 
45  public function testIsSubject() {
46  // Special namespaces
47  $this->assertIsSubject( NS_MEDIA );
48  $this->assertIsSubject( NS_SPECIAL );
49 
50  // Subject pages
51  $this->assertIsSubject( NS_MAIN );
52  $this->assertIsSubject( NS_USER );
53  $this->assertIsSubject( 100 ); # user defined
54 
55  // Talk pages
56  $this->assertIsNotSubject( NS_TALK );
57  $this->assertIsNotSubject( NS_USER_TALK );
58  $this->assertIsNotSubject( 101 ); # user defined
59  }
60 
66  public function testIsTalk() {
67  // Special namespaces
68  $this->assertIsNotTalk( NS_MEDIA );
69  $this->assertIsNotTalk( NS_SPECIAL );
70 
71  // Subject pages
72  $this->assertIsNotTalk( NS_MAIN );
73  $this->assertIsNotTalk( NS_USER );
74  $this->assertIsNotTalk( 100 ); # user defined
75 
76  // Talk pages
77  $this->assertIsTalk( NS_TALK );
78  $this->assertIsTalk( NS_USER_TALK );
79  $this->assertIsTalk( 101 ); # user defined
80  }
81 
85  public function testGetSubject() {
86  // Special namespaces are their own subjects
87  $this->assertEquals( NS_MEDIA, MWNamespace::getSubject( NS_MEDIA ) );
88  $this->assertEquals( NS_SPECIAL, MWNamespace::getSubject( NS_SPECIAL ) );
89 
90  $this->assertEquals( NS_MAIN, MWNamespace::getSubject( NS_TALK ) );
91  $this->assertEquals( NS_USER, MWNamespace::getSubject( NS_USER_TALK ) );
92  }
93 
100  public function testGetTalk() {
101  $this->assertEquals( NS_TALK, MWNamespace::getTalk( NS_MAIN ) );
102  $this->assertEquals( NS_TALK, MWNamespace::getTalk( NS_TALK ) );
103  $this->assertEquals( NS_USER_TALK, MWNamespace::getTalk( NS_USER ) );
104  $this->assertEquals( NS_USER_TALK, MWNamespace::getTalk( NS_USER_TALK ) );
105  }
106 
114  $this->assertNull( MWNamespace::getTalk( NS_MEDIA ) );
115  }
116 
124  $this->assertNull( MWNamespace::getTalk( NS_SPECIAL ) );
125  }
126 
133  public function testGetAssociated() {
134  $this->assertEquals( NS_TALK, MWNamespace::getAssociated( NS_MAIN ) );
135  $this->assertEquals( NS_MAIN, MWNamespace::getAssociated( NS_TALK ) );
136  }
137 
138  # ## Exceptions with getAssociated()
139  # ## NS_MEDIA and NS_SPECIAL do not have talk pages. MediaWiki raises
140  # ## an exception for them.
141 
146  $this->assertNull( MWNamespace::getAssociated( NS_MEDIA ) );
147  }
148 
154  $this->assertNull( MWNamespace::getAssociated( NS_SPECIAL ) );
155  }
156 
160  /*
161  public function testExists() {
162  // Remove the following lines when you implement this test.
163  $this->markTestIncomplete(
164  'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
165  );
166  }
167  */
168 
176  public function testEquals() {
177  $this->assertTrue( MWNamespace::equals( NS_MAIN, NS_MAIN ) );
178  $this->assertTrue( MWNamespace::equals( NS_MAIN, 0 ) ); // In case we make NS_MAIN 'MAIN'
179  $this->assertTrue( MWNamespace::equals( NS_USER, NS_USER ) );
180  $this->assertTrue( MWNamespace::equals( NS_USER, 2 ) );
181  $this->assertTrue( MWNamespace::equals( NS_USER_TALK, NS_USER_TALK ) );
182  $this->assertTrue( MWNamespace::equals( NS_SPECIAL, NS_SPECIAL ) );
183  $this->assertFalse( MWNamespace::equals( NS_MAIN, NS_TALK ) );
184  $this->assertFalse( MWNamespace::equals( NS_USER, NS_USER_TALK ) );
185  $this->assertFalse( MWNamespace::equals( NS_PROJECT, NS_TEMPLATE ) );
186  }
187 
191  public function testSubjectEquals() {
192  $this->assertSameSubject( NS_MAIN, NS_MAIN );
193  $this->assertSameSubject( NS_MAIN, 0 ); // In case we make NS_MAIN 'MAIN'
194  $this->assertSameSubject( NS_USER, NS_USER );
195  $this->assertSameSubject( NS_USER, 2 );
198  $this->assertSameSubject( NS_MAIN, NS_TALK );
200 
203  }
204 
209  $this->assertDifferentSubject(
211  "NS_MEDIA and NS_SPECIAL are different subject namespaces"
212  );
213  $this->assertDifferentSubject(
215  "NS_SPECIAL and NS_MEDIA are different subject namespaces"
216  );
217  }
218 
222  /*
223  public function testGetCanonicalNamespaces() {
224  // Remove the following lines when you implement this test.
225  $this->markTestIncomplete(
226  'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
227  );
228  }
229  */
233  /*
234  public function testGetCanonicalName() {
235  // Remove the following lines when you implement this test.
236  $this->markTestIncomplete(
237  'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
238  );
239  }
240  */
244  /*
245  public function testGetCanonicalIndex() {
246  // Remove the following lines when you implement this test.
247  $this->markTestIncomplete(
248  'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
249  );
250  }
251  */
252 
256  /*
257  public function testGetValidNamespaces() {
258  // Remove the following lines when you implement this test.
259  $this->markTestIncomplete(
260  'This test has not been implemented yet. Rely on $wgCanonicalNamespaces.'
261  );
262  }
263  */
264 
265  public function provideHasTalkNamespace() {
266  return [
267  [ NS_MEDIA, false ],
268  [ NS_SPECIAL, false ],
269 
270  [ NS_MAIN, true ],
271  [ NS_TALK, true ],
272  [ NS_USER, true ],
273  [ NS_USER_TALK, true ],
274 
275  [ 100, true ],
276  [ 101, true ],
277  ];
278  }
279 
287  public function testHasTalkNamespace( $index, $expected ) {
288  $actual = MWNamespace::hasTalkNamespace( $index );
289  $this->assertSame( $actual, $expected, "NS $index" );
290  }
291 
299  public function testCanTalk( $index, $expected ) {
300  $actual = MWNamespace::canTalk( $index );
301  $this->assertSame( $actual, $expected, "NS $index" );
302  }
303 
307  public function testIsContent() {
308  // NS_MAIN is a content namespace per DefaultSettings.php
309  // and per function definition.
310 
311  $this->assertIsContent( NS_MAIN );
312 
313  // Other namespaces which are not expected to be content
314 
315  $this->assertIsNotContent( NS_MEDIA );
316  $this->assertIsNotContent( NS_SPECIAL );
317  $this->assertIsNotContent( NS_TALK );
318  $this->assertIsNotContent( NS_USER );
319  $this->assertIsNotContent( NS_CATEGORY );
320  $this->assertIsNotContent( 100 );
321  }
322 
328  public function testIsContentAdvanced() {
330 
331  // Test that user defined namespace #252 is not content
332  $this->assertIsNotContent( 252 );
333 
334  // Bless namespace # 252 as a content namespace
335  $wgContentNamespaces[] = 252;
336 
337  $this->assertIsContent( 252 );
338 
339  // Makes sure NS_MAIN was not impacted
340  $this->assertIsContent( NS_MAIN );
341  }
342 
346  public function testIsWatchable() {
347  // Specials namespaces are not watchable
348  $this->assertIsNotWatchable( NS_MEDIA );
349  $this->assertIsNotWatchable( NS_SPECIAL );
350 
351  // Core defined namespaces are watchables
352  $this->assertIsWatchable( NS_MAIN );
353  $this->assertIsWatchable( NS_TALK );
354 
355  // Additional, user defined namespaces are watchables
356  $this->assertIsWatchable( 100 );
357  $this->assertIsWatchable( 101 );
358  }
359 
363  public function testHasSubpages() {
365 
366  // Special namespaces:
367  $this->assertHasNotSubpages( NS_MEDIA );
368  $this->assertHasNotSubpages( NS_SPECIAL );
369 
370  // Namespaces without subpages
371  $this->assertHasNotSubpages( NS_MAIN );
372 
374  $this->assertHasSubpages( NS_MAIN );
375 
377  $this->assertHasNotSubpages( NS_MAIN );
378 
379  // Some namespaces with subpages
380  $this->assertHasSubpages( NS_TALK );
381  $this->assertHasSubpages( NS_USER );
382  $this->assertHasSubpages( NS_USER_TALK );
383  }
384 
388  public function testGetContentNamespaces() {
390 
391  $this->assertEquals(
392  [ NS_MAIN ],
394  '$wgContentNamespaces is an array with only NS_MAIN by default'
395  );
396 
397  # test !is_array( $wgcontentNamespaces )
399  $this->assertEquals( [ NS_MAIN ], MWNamespace::getContentNamespaces() );
400 
401  $wgContentNamespaces = false;
402  $this->assertEquals( [ NS_MAIN ], MWNamespace::getContentNamespaces() );
403 
404  $wgContentNamespaces = null;
405  $this->assertEquals( [ NS_MAIN ], MWNamespace::getContentNamespaces() );
406 
408  $this->assertEquals( [ NS_MAIN ], MWNamespace::getContentNamespaces() );
409 
410  # test $wgContentNamespaces === []
412  $this->assertEquals( [ NS_MAIN ], MWNamespace::getContentNamespaces() );
413 
414  # test !in_array( NS_MAIN, $wgContentNamespaces )
416  $this->assertEquals(
419  'NS_MAIN is forced in $wgContentNamespaces even if unwanted'
420  );
421 
422  # test other cases, return $wgcontentNamespaces as is
424  $this->assertEquals(
425  [ NS_MAIN ],
427  );
428 
430  $this->assertEquals(
433  );
434  }
435 
439  public function testGetSubjectNamespaces() {
440  $subjectsNS = MWNamespace::getSubjectNamespaces();
441  $this->assertContains( NS_MAIN, $subjectsNS,
442  "Talk namespaces should have NS_MAIN" );
443  $this->assertNotContains( NS_TALK, $subjectsNS,
444  "Talk namespaces should have NS_TALK" );
445 
446  $this->assertNotContains( NS_MEDIA, $subjectsNS,
447  "Talk namespaces should not have NS_MEDIA" );
448  $this->assertNotContains( NS_SPECIAL, $subjectsNS,
449  "Talk namespaces should not have NS_SPECIAL" );
450  }
451 
455  public function testGetTalkNamespaces() {
456  $talkNS = MWNamespace::getTalkNamespaces();
457  $this->assertContains( NS_TALK, $talkNS,
458  "Subject namespaces should have NS_TALK" );
459  $this->assertNotContains( NS_MAIN, $talkNS,
460  "Subject namespaces should not have NS_MAIN" );
461 
462  $this->assertNotContains( NS_MEDIA, $talkNS,
463  "Subject namespaces should not have NS_MEDIA" );
464  $this->assertNotContains( NS_SPECIAL, $talkNS,
465  "Subject namespaces should not have NS_SPECIAL" );
466  }
467 
474  // NS_MEDIA and NS_FILE are treated the same
475  $this->assertEquals(
478  'NS_MEDIA and NS_FILE have same capitalization rendering'
479  );
480 
481  // Boths are capitalized by default
482  $this->assertIsCapitalized( NS_MEDIA );
483  $this->assertIsCapitalized( NS_FILE );
484 
485  // Always capitalized namespaces
486  // @see MWNamespace::$alwaysCapitalizedNamespaces
487  $this->assertIsCapitalized( NS_SPECIAL );
488  $this->assertIsCapitalized( NS_USER );
489  $this->assertIsCapitalized( NS_MEDIAWIKI );
490  }
491 
507 
508  $this->assertIsCapitalized( NS_PROJECT );
509  $this->assertIsCapitalized( NS_PROJECT_TALK );
510 
511  $wgCapitalLinks = false;
512 
513  // hardcoded namespaces (see above function) are still capitalized:
514  $this->assertIsCapitalized( NS_SPECIAL );
515  $this->assertIsCapitalized( NS_USER );
516  $this->assertIsCapitalized( NS_MEDIAWIKI );
517 
518  // setting is correctly applied
519  $this->assertIsNotCapitalized( NS_PROJECT );
520  $this->assertIsNotCapitalized( NS_PROJECT_TALK );
521  }
522 
532 
533  // Test default settings
534  $this->assertIsCapitalized( NS_PROJECT );
535  $this->assertIsCapitalized( NS_PROJECT_TALK );
536 
537  // hardcoded namespaces (see above function) are capitalized:
538  $this->assertIsCapitalized( NS_SPECIAL );
539  $this->assertIsCapitalized( NS_USER );
540  $this->assertIsCapitalized( NS_MEDIAWIKI );
541 
542  // Hardcoded namespaces remains capitalized
546 
547  $this->assertIsCapitalized( NS_SPECIAL );
548  $this->assertIsCapitalized( NS_USER );
549  $this->assertIsCapitalized( NS_MEDIAWIKI );
550 
552  $this->assertIsNotCapitalized( NS_PROJECT );
553 
555  $this->assertIsCapitalized( NS_PROJECT );
556 
558  $this->assertIsCapitalized( NS_PROJECT );
559  }
560 
564  public function testHasGenderDistinction() {
565  // Namespaces with gender distinctions
566  $this->assertTrue( MWNamespace::hasGenderDistinction( NS_USER ) );
567  $this->assertTrue( MWNamespace::hasGenderDistinction( NS_USER_TALK ) );
568 
569  // Other ones, "genderless"
570  $this->assertFalse( MWNamespace::hasGenderDistinction( NS_MEDIA ) );
571  $this->assertFalse( MWNamespace::hasGenderDistinction( NS_SPECIAL ) );
572  $this->assertFalse( MWNamespace::hasGenderDistinction( NS_MAIN ) );
573  $this->assertFalse( MWNamespace::hasGenderDistinction( NS_TALK ) );
574  }
575 
579  public function testIsNonincludable() {
581 
583 
584  $this->assertTrue( MWNamespace::isNonincludable( NS_USER ) );
585  $this->assertFalse( MWNamespace::isNonincludable( NS_TEMPLATE ) );
586  }
587 
588  # ###### HELPERS ###########################################################
589  function __call( $method, $args ) {
590  // Call the real method if it exists
591  if ( method_exists( $this, $method ) ) {
592  return $this->$method( $args );
593  }
594 
595  if ( preg_match(
596  '/^assert(Has|Is|Can)(Not|)(Subject|Talk|Watchable|Content|Subpages|Capitalized)$/',
597  $method,
598  $m
599  ) ) {
600  # Interprets arguments:
601  $ns = $args[0];
602  $msg = isset( $args[1] ) ? $args[1] : " dummy message";
603 
604  # Forge the namespace constant name:
605  if ( $ns === 0 ) {
606  $ns_name = "NS_MAIN";
607  } else {
608  $ns_name = "NS_" . strtoupper( MWNamespace::getCanonicalName( $ns ) );
609  }
610  # ... and the MWNamespace method name
611  $nsMethod = strtolower( $m[1] ) . $m[3];
612 
613  $expect = ( $m[2] === '' );
614  $expect_name = $expect ? 'TRUE' : 'FALSE';
615 
616  return $this->assertEquals( $expect,
617  MWNamespace::$nsMethod( $ns, $msg ),
618  "MWNamespace::$nsMethod( $ns_name ) should returns $expect_name"
619  );
620  }
621 
622  throw new Exception( __METHOD__ . " could not find a method named $method\n" );
623  }
624 
625  function assertSameSubject( $ns1, $ns2, $msg = '' ) {
626  $this->assertTrue( MWNamespace::subjectEquals( $ns1, $ns2, $msg ) );
627  }
628 
629  function assertDifferentSubject( $ns1, $ns2, $msg = '' ) {
630  $this->assertFalse( MWNamespace::subjectEquals( $ns1, $ns2, $msg ) );
631  }
632 }
$wgNonincludableNamespaces
$wgNonincludableNamespaces
Pages in namespaces in this array can not be used as templates.
Definition: DefaultSettings.php:5368
MWNamespaceTest\testIsContentAdvanced
testIsContentAdvanced()
Similar to testIsContent() but alters the $wgContentNamespaces global variable.
Definition: MWNamespaceTest.php:328
MWNamespaceTest\testSubjectEquals
testSubjectEquals()
MWNamespace::subjectEquals.
Definition: MWNamespaceTest.php:191
MWNamespace\subjectEquals
static subjectEquals( $ns1, $ns2)
Returns whether the specified namespaces share the same subject.
Definition: MWNamespace.php:194
MWNamespace\isNonincludable
static isNonincludable( $index)
It is not possible to use pages from this namespace as template?
Definition: MWNamespace.php:436
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187
MWNamespaceTest\assertDifferentSubject
assertDifferentSubject( $ns1, $ns2, $msg='')
Definition: MWNamespaceTest.php:629
MWNamespace\hasGenderDistinction
static hasGenderDistinction( $index)
Does the namespace (potentially) have different aliases for different genders.
Definition: MWNamespace.php:425
MWNamespace\getTalkNamespaces
static getTalkNamespaces()
List all namespace indices which are considered talks, aka not a subject or special namespace.
Definition: MWNamespace.php:384
MWNamespaceTest\setUp
setUp()
Definition: MWNamespaceTest.php:14
MWNamespaceTest\testGetSubjectNamespaces
testGetSubjectNamespaces()
MWNamespace::getSubjectNamespaces.
Definition: MWNamespaceTest.php:439
MWNamespaceTest\testGetAssociated
testGetAssociated()
Regular getAssociated() calls Namespaces without an associated page (NS_MEDIA, NS_SPECIAL) are tested...
Definition: MWNamespaceTest.php:133
MWNamespaceTest\__call
__call( $method, $args)
Definition: MWNamespaceTest.php:589
MWNamespaceTest\testGetContentNamespaces
testGetContentNamespaces()
MWNamespace::getContentNamespaces.
Definition: MWNamespaceTest.php:388
MWNamespaceTest\testHasTalkNamespace
testHasTalkNamespace( $index, $expected)
provideHasTalkNamespace MWNamespace::hasTalkNamespace
Definition: MWNamespaceTest.php:287
MWNamespaceTest\testIsNonincludable
testIsNonincludable()
MWNamespace::isNonincludable.
Definition: MWNamespaceTest.php:579
MWNamespaceTest\testIsSubject
testIsSubject()
Please make sure to change testIsTalk() if you change the assertions below MWNamespace::isSubject.
Definition: MWNamespaceTest.php:45
NS_FILE
const NS_FILE
Definition: Defines.php:71
NS_TEMPLATE
const NS_TEMPLATE
Definition: Defines.php:75
MWNamespaceTest\provideHasTalkNamespace
provideHasTalkNamespace()
Definition: MWNamespaceTest.php:265
MWNamespaceTest\testGetSubject
testGetSubject()
MWNamespace::getSubject.
Definition: MWNamespaceTest.php:85
MWNamespaceTest\testIsCapitalizedWithWgCapitalLinks
testIsCapitalizedWithWgCapitalLinks()
Follows up for testIsCapitalizedHardcodedAssertions() but alter the global $wgCapitalLink setting to ...
Definition: MWNamespaceTest.php:505
MWNamespace\getSubjectNamespaces
static getSubjectNamespaces()
List all namespace indices which are considered subject, aka not a talk or special namespace.
Definition: MWNamespace.php:371
MWNamespaceTest\testSpecialAndMediaAreDifferentSubjects
testSpecialAndMediaAreDifferentSubjects()
MWNamespace::subjectEquals.
Definition: MWNamespaceTest.php:208
MWNamespace\getContentNamespaces
static getContentNamespaces()
Get a list of all namespace indices which are considered to contain content.
Definition: MWNamespace.php:353
php
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
Definition: injection.txt:35
NS_MAIN
const NS_MAIN
Definition: Defines.php:65
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:54
MWNamespaceTest\testCanTalk
testCanTalk( $index, $expected)
provideHasTalkNamespace MWNamespace::canTalk
Definition: MWNamespaceTest.php:299
NS_PROJECT
const NS_PROJECT
Definition: Defines.php:69
user
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
Definition: distributors.txt:9
MWNamespaceTest
Test class for MWNamespace.
Definition: MWNamespaceTest.php:13
MediaWikiTestCase\setMwGlobals
setMwGlobals( $pairs, $value=null)
Sets a global, maintaining a stashed version of the previous global to be restored in tearDown.
Definition: MediaWikiTestCase.php:672
MediaWikiTestCase
Definition: MediaWikiTestCase.php:15
MWNamespace\canTalk
static canTalk( $index)
Does this namespace ever have a talk namespace?
Definition: MWNamespace.php:288
MWNamespaceTest\testIsTalk
testIsTalk()
Reverse of testIsSubject().
Definition: MWNamespaceTest.php:66
MWNamespace\hasTalkNamespace
static hasTalkNamespace( $index)
Does this namespace ever have a talk namespace?
Definition: MWNamespace.php:300
MWNamespaceTest\testGetTalkNamespaces
testGetTalkNamespaces()
MWNamespace::getTalkNamespaces.
Definition: MWNamespaceTest.php:455
MWNamespaceTest\testIsWatchable
testIsWatchable()
MWNamespace::isWatchable.
Definition: MWNamespaceTest.php:346
MWNamespace\isMovable
static isMovable( $index)
Can pages in the given namespace be moved?
Definition: MWNamespace.php:66
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:79
MWNamespaceTest\assertSameSubject
assertSameSubject( $ns1, $ns2, $msg='')
Definition: MWNamespaceTest.php:625
MWNamespaceTest\testIsMovable
testIsMovable()
Definition: MWNamespaceTest.php:36
MWNamespaceTest\testEquals
testEquals()
Test MWNamespace::equals Note if we add a namespace registration system with keys like 'MAIN' we shou...
Definition: MWNamespaceTest.php:176
NS_USER_TALK
const NS_USER_TALK
Definition: Defines.php:68
MWNamespaceTest\testGetAssociatedExceptionsForNsMedia
testGetAssociatedExceptionsForNsMedia()
MWException MWNamespace::getAssociated.
Definition: MWNamespaceTest.php:145
NS_MEDIA
const NS_MEDIA
Definition: Defines.php:53
MWNamespaceTest\testIsCapitalizedHardcodedAssertions
testIsCapitalizedHardcodedAssertions()
Some namespaces are always capitalized per code definition in MWNamespace::$alwaysCapitalizedNamespac...
Definition: MWNamespaceTest.php:473
NS_PROJECT_TALK
const NS_PROJECT_TALK
Definition: Defines.php:70
MWNamespaceTest\testGetTalkExceptionsForNsMedia
testGetTalkExceptionsForNsMedia()
Exceptions with getTalk() NS_MEDIA does not have talk pages.
Definition: MWNamespaceTest.php:113
$wgContentNamespaces
$wgContentNamespaces
Array of namespaces which can be deemed to contain valid "content", as far as the site statistics are...
Definition: DefaultSettings.php:4111
$args
if( $line===false) $args
Definition: cdb.php:63
MWNamespaceTest\testIsCapitalizedWithWgCapitalLinkOverrides
testIsCapitalizedWithWgCapitalLinkOverrides()
Counter part for MWNamespace::testIsCapitalizedWithWgCapitalLinks() now testing the $wgCapitalLinkOve...
Definition: MWNamespaceTest.php:530
MWNamespaceTest\testGetTalkExceptionsForNsSpecial
testGetTalkExceptionsForNsSpecial()
Exceptions with getTalk() NS_SPECIAL does not have talk pages.
Definition: MWNamespaceTest.php:123
$wgCapitalLinks
$wgCapitalLinks
Set this to false to avoid forcing the first letter of links to capitals.
Definition: DefaultSettings.php:4050
MWNamespace\equals
static equals( $ns1, $ns2)
Returns whether the specified namespaces are the same namespace.
Definition: MWNamespace.php:179
$wgCapitalLinkOverrides
$wgCapitalLinkOverrides
Definition: DefaultSettings.php:4066
MWNamespace\isCapitalized
static isCapitalized( $index)
Is the namespace first-letter capitalized?
Definition: MWNamespace.php:397
NS_USER
const NS_USER
Definition: Defines.php:67
MWNamespaceTest\testHasSubpages
testHasSubpages()
MWNamespace::hasSubpages.
Definition: MWNamespaceTest.php:363
true
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
Definition: hooks.txt:1965
NS_TALK
const NS_TALK
Definition: Defines.php:66
NS_MEDIAWIKI
const NS_MEDIAWIKI
Definition: Defines.php:73
MWNamespace\getTalk
static getTalk( $index)
Get the talk namespace index for a given namespace.
Definition: MWNamespace.php:107
MWNamespaceTest\testGetTalk
testGetTalk()
Regular getTalk() calls Namespaces without a talk page (NS_MEDIA, NS_SPECIAL) are tested in the funct...
Definition: MWNamespaceTest.php:100
MWNamespace\getSubject
static getSubject( $index)
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA,...
Definition: MWNamespace.php:121
$wgNamespacesWithSubpages
$wgNamespacesWithSubpages
Which namespaces should support subpages? See Language.php for a list of namespaces.
Definition: DefaultSettings.php:4072
MWNamespaceTest\testGetAssociatedExceptionsForNsSpecial
testGetAssociatedExceptionsForNsSpecial()
MWException MWNamespace::getAssociated.
Definition: MWNamespaceTest.php:153
MWNamespaceTest\testIsContent
testIsContent()
MWNamespace::isContent.
Definition: MWNamespaceTest.php:307
MWNamespace\getAssociated
static getAssociated( $index)
Get the associated namespace.
Definition: MWNamespace.php:140
MWNamespace\getCanonicalName
static getCanonicalName( $index)
Returns the canonical (English) name for a given index.
Definition: MWNamespace.php:228
MWNamespaceTest\testHasGenderDistinction
testHasGenderDistinction()
MWNamespace::hasGenderDistinction.
Definition: MWNamespaceTest.php:564