MediaWiki  1.33.0
MWNamespaceTest.php
Go to the documentation of this file.
1 <?php
9 
10  protected function setUp() {
11  parent::setUp();
12 
13  $this->setMwGlobals( [
14  'wgContentNamespaces' => [ NS_MAIN ],
15  'wgNamespacesWithSubpages' => [
16  NS_TALK => true,
17  NS_USER => true,
18  NS_USER_TALK => true,
19  ],
20  'wgCapitalLinks' => true,
21  'wgCapitalLinkOverrides' => [],
22  'wgNonincludableNamespaces' => [],
23  ] );
24  }
25 
30  public function testIsMovable() {
31  $this->assertFalse( MWNamespace::isMovable( NS_SPECIAL ) );
32  }
33 
34  private function assertIsSubject( $ns ) {
35  $this->assertTrue( MWNamespace::isSubject( $ns ) );
36  }
37 
38  private function assertIsNotSubject( $ns ) {
39  $this->assertFalse( MWNamespace::isSubject( $ns ) );
40  }
41 
46  public function testIsSubject() {
47  // Special namespaces
48  $this->assertIsSubject( NS_MEDIA );
49  $this->assertIsSubject( NS_SPECIAL );
50 
51  // Subject pages
52  $this->assertIsSubject( NS_MAIN );
53  $this->assertIsSubject( NS_USER );
54  $this->assertIsSubject( 100 ); # user defined
55 
56  // Talk pages
57  $this->assertIsNotSubject( NS_TALK );
59  $this->assertIsNotSubject( 101 ); # user defined
60  }
61 
62  private function assertIsTalk( $ns ) {
63  $this->assertTrue( MWNamespace::isTalk( $ns ) );
64  }
65 
66  private function assertIsNotTalk( $ns ) {
67  $this->assertFalse( MWNamespace::isTalk( $ns ) );
68  }
69 
75  public function testIsTalk() {
76  // Special namespaces
77  $this->assertIsNotTalk( NS_MEDIA );
78  $this->assertIsNotTalk( NS_SPECIAL );
79 
80  // Subject pages
81  $this->assertIsNotTalk( NS_MAIN );
82  $this->assertIsNotTalk( NS_USER );
83  $this->assertIsNotTalk( 100 ); # user defined
84 
85  // Talk pages
86  $this->assertIsTalk( NS_TALK );
87  $this->assertIsTalk( NS_USER_TALK );
88  $this->assertIsTalk( 101 ); # user defined
89  }
90 
94  public function testGetSubject() {
95  // Special namespaces are their own subjects
96  $this->assertEquals( NS_MEDIA, MWNamespace::getSubject( NS_MEDIA ) );
97  $this->assertEquals( NS_SPECIAL, MWNamespace::getSubject( NS_SPECIAL ) );
98 
99  $this->assertEquals( NS_MAIN, MWNamespace::getSubject( NS_TALK ) );
100  $this->assertEquals( NS_USER, MWNamespace::getSubject( NS_USER_TALK ) );
101  }
102 
109  public function testGetTalk() {
110  $this->assertEquals( NS_TALK, MWNamespace::getTalk( NS_MAIN ) );
111  $this->assertEquals( NS_TALK, MWNamespace::getTalk( NS_TALK ) );
112  $this->assertEquals( NS_USER_TALK, MWNamespace::getTalk( NS_USER ) );
113  $this->assertEquals( NS_USER_TALK, MWNamespace::getTalk( NS_USER_TALK ) );
114  }
115 
123  $this->assertNull( MWNamespace::getTalk( NS_MEDIA ) );
124  }
125 
133  $this->assertNull( MWNamespace::getTalk( NS_SPECIAL ) );
134  }
135 
142  public function testGetAssociated() {
143  $this->assertEquals( NS_TALK, MWNamespace::getAssociated( NS_MAIN ) );
144  $this->assertEquals( NS_MAIN, MWNamespace::getAssociated( NS_TALK ) );
145  }
146 
147  # ## Exceptions with getAssociated()
148  # ##┬áNS_MEDIA and NS_SPECIAL do not have talk pages. MediaWiki raises
149  # ## an exception for them.
150 
155  $this->assertNull( MWNamespace::getAssociated( NS_MEDIA ) );
156  }
157 
163  $this->assertNull( MWNamespace::getAssociated( NS_SPECIAL ) );
164  }
165 
173  public function testEquals() {
174  $this->assertTrue( MWNamespace::equals( NS_MAIN, NS_MAIN ) );
175  $this->assertTrue( MWNamespace::equals( NS_MAIN, 0 ) ); // In case we make NS_MAIN 'MAIN'
176  $this->assertTrue( MWNamespace::equals( NS_USER, NS_USER ) );
177  $this->assertTrue( MWNamespace::equals( NS_USER, 2 ) );
178  $this->assertTrue( MWNamespace::equals( NS_USER_TALK, NS_USER_TALK ) );
179  $this->assertTrue( MWNamespace::equals( NS_SPECIAL, NS_SPECIAL ) );
180  $this->assertFalse( MWNamespace::equals( NS_MAIN, NS_TALK ) );
181  $this->assertFalse( MWNamespace::equals( NS_USER, NS_USER_TALK ) );
182  $this->assertFalse( MWNamespace::equals( NS_PROJECT, NS_TEMPLATE ) );
183  }
184 
188  public function testSubjectEquals() {
189  $this->assertSameSubject( NS_MAIN, NS_MAIN );
190  $this->assertSameSubject( NS_MAIN, 0 ); // In case we make NS_MAIN 'MAIN'
191  $this->assertSameSubject( NS_USER, NS_USER );
192  $this->assertSameSubject( NS_USER, 2 );
195  $this->assertSameSubject( NS_MAIN, NS_TALK );
197 
200  }
201 
206  $this->assertDifferentSubject(
208  "NS_MEDIA and NS_SPECIAL are different subject namespaces"
209  );
210  $this->assertDifferentSubject(
212  "NS_SPECIAL and NS_MEDIA are different subject namespaces"
213  );
214  }
215 
216  public function provideHasTalkNamespace() {
217  return [
218  [ NS_MEDIA, false ],
219  [ NS_SPECIAL, false ],
220 
221  [ NS_MAIN, true ],
222  [ NS_TALK, true ],
223  [ NS_USER, true ],
224  [ NS_USER_TALK, true ],
225 
226  [ 100, true ],
227  [ 101, true ],
228  ];
229  }
230 
238  public function testHasTalkNamespace( $index, $expected ) {
239  $actual = MWNamespace::hasTalkNamespace( $index );
240  $this->assertSame( $actual, $expected, "NS $index" );
241  }
242 
250  public function testCanTalk( $index, $expected ) {
251  $this->hideDeprecated( 'MWNamespace::canTalk' );
252  $actual = MWNamespace::canTalk( $index );
253  $this->assertSame( $actual, $expected, "NS $index" );
254  }
255 
256  private function assertIsContent( $ns ) {
257  $this->assertTrue( MWNamespace::isContent( $ns ) );
258  }
259 
260  private function assertIsNotContent( $ns ) {
261  $this->assertFalse( MWNamespace::isContent( $ns ) );
262  }
263 
267  public function testIsContent() {
268  // NS_MAIN is a content namespace per DefaultSettings.php
269  // and per function definition.
270 
271  $this->assertIsContent( NS_MAIN );
272 
273  // Other namespaces which are not expected to be content
274 
275  $this->assertIsNotContent( NS_MEDIA );
276  $this->assertIsNotContent( NS_SPECIAL );
277  $this->assertIsNotContent( NS_TALK );
278  $this->assertIsNotContent( NS_USER );
280  $this->assertIsNotContent( 100 );
281  }
282 
288  public function testIsContentAdvanced() {
289  global $wgContentNamespaces;
290 
291  // Test that user defined namespace #252 is not content
292  $this->assertIsNotContent( 252 );
293 
294  // Bless namespace # 252 as a content namespace
295  $wgContentNamespaces[] = 252;
296 
297  $this->assertIsContent( 252 );
298 
299  // Makes sure NS_MAIN was not impacted
300  $this->assertIsContent( NS_MAIN );
301  }
302 
303  private function assertIsWatchable( $ns ) {
304  $this->assertTrue( MWNamespace::isWatchable( $ns ) );
305  }
306 
307  private function assertIsNotWatchable( $ns ) {
308  $this->assertFalse( MWNamespace::isWatchable( $ns ) );
309  }
310 
314  public function testIsWatchable() {
315  // Specials namespaces are not watchable
316  $this->assertIsNotWatchable( NS_MEDIA );
318 
319  // Core defined namespaces are watchables
320  $this->assertIsWatchable( NS_MAIN );
321  $this->assertIsWatchable( NS_TALK );
322 
323  // Additional, user defined namespaces are watchables
324  $this->assertIsWatchable( 100 );
325  $this->assertIsWatchable( 101 );
326  }
327 
328  private function assertHasSubpages( $ns ) {
329  $this->assertTrue( MWNamespace::hasSubpages( $ns ) );
330  }
331 
332  private function assertHasNotSubpages( $ns ) {
333  $this->assertFalse( MWNamespace::hasSubpages( $ns ) );
334  }
335 
339  public function testHasSubpages() {
341 
342  // Special namespaces:
343  $this->assertHasNotSubpages( NS_MEDIA );
345 
346  // Namespaces without subpages
347  $this->assertHasNotSubpages( NS_MAIN );
348 
349  $wgNamespacesWithSubpages[NS_MAIN] = true;
350  $this->assertHasSubpages( NS_MAIN );
351 
352  $wgNamespacesWithSubpages[NS_MAIN] = false;
353  $this->assertHasNotSubpages( NS_MAIN );
354 
355  // Some namespaces with subpages
356  $this->assertHasSubpages( NS_TALK );
357  $this->assertHasSubpages( NS_USER );
359  }
360 
364  public function testGetContentNamespaces() {
365  global $wgContentNamespaces;
366 
367  $this->assertEquals(
368  [ NS_MAIN ],
370  '$wgContentNamespaces is an array with only NS_MAIN by default'
371  );
372 
373  # test !is_array( $wgcontentNamespaces )
375  $this->assertEquals( [ NS_MAIN ], MWNamespace::getContentNamespaces() );
376 
377  $wgContentNamespaces = false;
378  $this->assertEquals( [ NS_MAIN ], MWNamespace::getContentNamespaces() );
379 
380  $wgContentNamespaces = null;
381  $this->assertEquals( [ NS_MAIN ], MWNamespace::getContentNamespaces() );
382 
384  $this->assertEquals( [ NS_MAIN ], MWNamespace::getContentNamespaces() );
385 
386  # test $wgContentNamespaces === []
388  $this->assertEquals( [ NS_MAIN ], MWNamespace::getContentNamespaces() );
389 
390  # test !in_array( NS_MAIN, $wgContentNamespaces )
392  $this->assertEquals(
395  'NS_MAIN is forced in $wgContentNamespaces even if unwanted'
396  );
397 
398  # test other cases, return $wgcontentNamespaces as is
400  $this->assertEquals(
401  [ NS_MAIN ],
403  );
404 
406  $this->assertEquals(
409  );
410  }
411 
415  public function testGetSubjectNamespaces() {
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" );
421 
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" );
426  }
427 
431  public function testGetTalkNamespaces() {
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" );
437 
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" );
442  }
443 
444  private function assertIsCapitalized( $ns ) {
445  $this->assertTrue( MWNamespace::isCapitalized( $ns ) );
446  }
447 
448  private function assertIsNotCapitalized( $ns ) {
449  $this->assertFalse( MWNamespace::isCapitalized( $ns ) );
450  }
451 
458  // NS_MEDIA and NS_FILE are treated the same
459  $this->assertEquals(
462  'NS_MEDIA and NS_FILE have same capitalization rendering'
463  );
464 
465  // Boths are capitalized by default
466  $this->assertIsCapitalized( NS_MEDIA );
467  $this->assertIsCapitalized( NS_FILE );
468 
469  // Always capitalized namespaces
470  // @see MWNamespace::$alwaysCapitalizedNamespaces
472  $this->assertIsCapitalized( NS_USER );
474  }
475 
490  global $wgCapitalLinks;
491 
494 
495  $wgCapitalLinks = false;
496 
497  // hardcoded namespaces (see above function) are still capitalized:
499  $this->assertIsCapitalized( NS_USER );
501 
502  // setting is correctly applied
505  }
506 
516 
517  // Test default settings
520 
521  // hardcoded namespaces (see above function) are capitalized:
523  $this->assertIsCapitalized( NS_USER );
525 
526  // Hardcoded namespaces remains capitalized
527  $wgCapitalLinkOverrides[NS_SPECIAL] = false;
530 
532  $this->assertIsCapitalized( NS_USER );
534 
535  $wgCapitalLinkOverrides[NS_PROJECT] = false;
537 
538  $wgCapitalLinkOverrides[NS_PROJECT] = true;
540 
542  $this->assertIsCapitalized( NS_PROJECT );
543  }
544 
548  public function testHasGenderDistinction() {
549  // Namespaces with gender distinctions
550  $this->assertTrue( MWNamespace::hasGenderDistinction( NS_USER ) );
551  $this->assertTrue( MWNamespace::hasGenderDistinction( NS_USER_TALK ) );
552 
553  // Other ones, "genderless"
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 ) );
558  }
559 
563  public function testIsNonincludable() {
565 
567 
568  $this->assertTrue( MWNamespace::isNonincludable( NS_USER ) );
569  $this->assertFalse( MWNamespace::isNonincludable( NS_TEMPLATE ) );
570  }
571 
572  private function assertSameSubject( $ns1, $ns2, $msg = '' ) {
573  $this->assertTrue( MWNamespace::subjectEquals( $ns1, $ns2 ), $msg );
574  }
575 
576  private function assertDifferentSubject( $ns1, $ns2, $msg = '' ) {
577  $this->assertFalse( MWNamespace::subjectEquals( $ns1, $ns2 ), $msg );
578  }
579 
580  public function provideGetCategoryLinkType() {
581  return [
582  [ NS_MAIN, 'page' ],
583  [ NS_TALK, 'page' ],
584  [ NS_USER, 'page' ],
585  [ NS_USER_TALK, 'page' ],
586 
587  [ NS_FILE, 'file' ],
588  [ NS_FILE_TALK, 'page' ],
589 
590  [ NS_CATEGORY, 'subcat' ],
591  [ NS_CATEGORY_TALK, 'page' ],
592 
593  [ 100, 'page' ],
594  [ 101, 'page' ],
595  ];
596  }
597 
605  public function testGetCategoryLinkType( $index, $expected ) {
606  $actual = MWNamespace::getCategoryLinkType( $index );
607  $this->assertSame( $expected, $actual, "NS $index" );
608  }
609 }
$wgNonincludableNamespaces
$wgNonincludableNamespaces
Pages in namespaces in this array can not be used as templates.
Definition: DefaultSettings.php:5345
MWNamespaceTest\testIsContentAdvanced
testIsContentAdvanced()
Similar to testIsContent() but alters the $wgContentNamespaces global variable.
Definition: MWNamespaceTest.php:288
MWNamespaceTest\testSubjectEquals
testSubjectEquals()
MWNamespace::subjectEquals.
Definition: MWNamespaceTest.php:188
MWNamespace\subjectEquals
static subjectEquals( $ns1, $ns2)
Returns whether the specified namespaces share the same subject.
Definition: MWNamespace.php:217
MWNamespace\isNonincludable
static isNonincludable( $index)
It is not possible to use pages from this namespace as template?
Definition: MWNamespace.php:458
false
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187
MWNamespaceTest\assertIsNotWatchable
assertIsNotWatchable( $ns)
Definition: MWNamespaceTest.php:307
MWNamespaceTest\assertDifferentSubject
assertDifferentSubject( $ns1, $ns2, $msg='')
Definition: MWNamespaceTest.php:576
MWNamespace\hasGenderDistinction
static hasGenderDistinction( $index)
Does the namespace (potentially) have different aliases for different genders.
Definition: MWNamespace.php:447
MWNamespace\isTalk
static isTalk( $index)
Is the given namespace a talk namespace?
Definition: MWNamespace.php:119
MWNamespace\getTalkNamespaces
static getTalkNamespaces()
List all namespace indices which are considered talks, aka not a subject or special namespace.
Definition: MWNamespace.php:406
MWNamespaceTest\setUp
setUp()
Definition: MWNamespaceTest.php:10
MWNamespaceTest\testGetSubjectNamespaces
testGetSubjectNamespaces()
MWNamespace::getSubjectNamespaces.
Definition: MWNamespaceTest.php:415
MWNamespaceTest\testGetAssociated
testGetAssociated()
Regular getAssociated() calls Namespaces without an associated page (NS_MEDIA, NS_SPECIAL) are tested...
Definition: MWNamespaceTest.php:142
MWNamespaceTest\testGetContentNamespaces
testGetContentNamespaces()
MWNamespace::getContentNamespaces.
Definition: MWNamespaceTest.php:364
MWNamespaceTest\testHasTalkNamespace
testHasTalkNamespace( $index, $expected)
provideHasTalkNamespace MWNamespace::hasTalkNamespace
Definition: MWNamespaceTest.php:238
MWNamespaceTest\testIsNonincludable
testIsNonincludable()
MWNamespace::isNonincludable.
Definition: MWNamespaceTest.php:563
MWNamespaceTest\testIsSubject
testIsSubject()
Please make sure to change testIsTalk() if you change the assertions below MWNamespace::isSubject.
Definition: MWNamespaceTest.php:46
NS_FILE
const NS_FILE
Definition: Defines.php:70
MWNamespaceTest\assertIsNotTalk
assertIsNotTalk( $ns)
Definition: MWNamespaceTest.php:66
NS_TEMPLATE
const NS_TEMPLATE
Definition: Defines.php:74
MWNamespaceTest\provideHasTalkNamespace
provideHasTalkNamespace()
Definition: MWNamespaceTest.php:216
MWNamespaceTest\assertIsNotCapitalized
assertIsNotCapitalized( $ns)
Definition: MWNamespaceTest.php:448
MWNamespaceTest\testGetSubject
testGetSubject()
MWNamespace::getSubject.
Definition: MWNamespaceTest.php:94
MWNamespaceTest\testIsCapitalizedWithWgCapitalLinks
testIsCapitalizedWithWgCapitalLinks()
Follows up for testIsCapitalizedHardcodedAssertions() but alter the global $wgCapitalLink setting to ...
Definition: MWNamespaceTest.php:489
MWNamespace\getSubjectNamespaces
static getSubjectNamespaces()
List all namespace indices which are considered subject, aka not a talk or special namespace.
Definition: MWNamespace.php:393
MWNamespaceTest\assertHasSubpages
assertHasSubpages( $ns)
Definition: MWNamespaceTest.php:328
MWNamespaceTest\testSpecialAndMediaAreDifferentSubjects
testSpecialAndMediaAreDifferentSubjects()
MWNamespace::subjectEquals.
Definition: MWNamespaceTest.php:205
MWNamespace\getContentNamespaces
static getContentNamespaces()
Get a list of all namespace indices which are considered to contain content.
Definition: MWNamespace.php:375
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:64
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:53
MWNamespaceTest\testCanTalk
testCanTalk( $index, $expected)
provideHasTalkNamespace MWNamespace::canTalk
Definition: MWNamespaceTest.php:250
NS_PROJECT
const NS_PROJECT
Definition: Defines.php:68
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\assertIsContent
assertIsContent( $ns)
Definition: MWNamespaceTest.php:256
MWNamespaceTest
Definition: MWNamespaceTest.php:8
MWNamespaceTest\assertIsNotSubject
assertIsNotSubject( $ns)
Definition: MWNamespaceTest.php:38
MWNamespaceTest\assertHasNotSubpages
assertHasNotSubpages( $ns)
Definition: MWNamespaceTest.php:332
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:709
MediaWikiTestCase
Definition: MediaWikiTestCase.php:17
MWNamespace\canTalk
static canTalk( $index)
Does this namespace ever have a talk namespace?
Definition: MWNamespace.php:309
MWNamespaceTest\testIsTalk
testIsTalk()
Reverse of testIsSubject().
Definition: MWNamespaceTest.php:75
MWNamespace\isContent
static isContent( $index)
Does this namespace contain content, for the purposes of calculating statistics, etc?
Definition: MWNamespace.php:333
MediaWikiTestCase\hideDeprecated
hideDeprecated( $function)
Don't throw a warning if $function is deprecated and called later.
Definition: MediaWikiTestCase.php:1974
MWNamespace\hasTalkNamespace
static hasTalkNamespace( $index)
Does this namespace ever have a talk namespace?
Definition: MWNamespace.php:322
MWNamespace\hasSubpages
static hasSubpages( $index)
Does the namespace allow subpages?
Definition: MWNamespace.php:366
MWNamespaceTest\testGetTalkNamespaces
testGetTalkNamespaces()
MWNamespace::getTalkNamespaces.
Definition: MWNamespaceTest.php:431
MWNamespaceTest\testIsWatchable
testIsWatchable()
MWNamespace::isWatchable.
Definition: MWNamespaceTest.php:314
MWNamespace\isMovable
static isMovable( $index)
Can pages in the given namespace be moved?
Definition: MWNamespace.php:89
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:78
MWNamespaceTest\assertSameSubject
assertSameSubject( $ns1, $ns2, $msg='')
Definition: MWNamespaceTest.php:572
MWNamespaceTest\testIsMovable
testIsMovable()
Definition: MWNamespaceTest.php:30
MWNamespace\isSubject
static isSubject( $index)
Is the given namespace is a subject (non-talk) namespace?
Definition: MWNamespace.php:109
MWNamespaceTest\assertIsNotContent
assertIsNotContent( $ns)
Definition: MWNamespaceTest.php:260
MWNamespaceTest\testEquals
testEquals()
Test MWNamespace::equals Note if we add a namespace registration system with keys like 'MAIN' we shou...
Definition: MWNamespaceTest.php:173
MWNamespaceTest\assertIsWatchable
assertIsWatchable( $ns)
Definition: MWNamespaceTest.php:303
NS_USER_TALK
const NS_USER_TALK
Definition: Defines.php:67
MWNamespaceTest\testGetAssociatedExceptionsForNsMedia
testGetAssociatedExceptionsForNsMedia()
MWException MWNamespace::getAssociated.
Definition: MWNamespaceTest.php:154
NS_MEDIA
const NS_MEDIA
Definition: Defines.php:52
MWNamespaceTest\testIsCapitalizedHardcodedAssertions
testIsCapitalizedHardcodedAssertions()
Some namespaces are always capitalized per code definition in MWNamespace::$alwaysCapitalizedNamespac...
Definition: MWNamespaceTest.php:457
MWNamespaceTest\assertIsSubject
assertIsSubject( $ns)
Definition: MWNamespaceTest.php:34
NS_PROJECT_TALK
const NS_PROJECT_TALK
Definition: Defines.php:69
MWNamespaceTest\testGetTalkExceptionsForNsMedia
testGetTalkExceptionsForNsMedia()
Exceptions with getTalk() NS_MEDIA does not have talk pages.
Definition: MWNamespaceTest.php:122
MWNamespaceTest\testGetCategoryLinkType
testGetCategoryLinkType( $index, $expected)
provideGetCategoryLinkType MWNamespace::getCategoryLinkType
Definition: MWNamespaceTest.php:605
$wgContentNamespaces
$wgContentNamespaces
Array of namespaces which can be deemed to contain valid "content", as far as the site statistics are...
Definition: DefaultSettings.php:4053
MWNamespaceTest\testIsCapitalizedWithWgCapitalLinkOverrides
testIsCapitalizedWithWgCapitalLinkOverrides()
Counter part for MWNamespace::testIsCapitalizedWithWgCapitalLinks() now testing the $wgCapitalLinkOve...
Definition: MWNamespaceTest.php:514
MWNamespaceTest\testGetTalkExceptionsForNsSpecial
testGetTalkExceptionsForNsSpecial()
Exceptions with getTalk() NS_SPECIAL does not have talk pages.
Definition: MWNamespaceTest.php:132
$wgCapitalLinks
$wgCapitalLinks
Set this to false to avoid forcing the first letter of links to capitals.
Definition: DefaultSettings.php:3992
MWNamespace\equals
static equals( $ns1, $ns2)
Returns whether the specified namespaces are the same namespace.
Definition: MWNamespace.php:202
MWNamespace\getCategoryLinkType
static getCategoryLinkType( $index)
Returns the link type to be used for categories.
Definition: MWNamespace.php:560
$wgCapitalLinkOverrides
$wgCapitalLinkOverrides
Definition: DefaultSettings.php:4008
MWNamespace\isCapitalized
static isCapitalized( $index)
Is the namespace first-letter capitalized?
Definition: MWNamespace.php:419
MWNamespaceTest\provideGetCategoryLinkType
provideGetCategoryLinkType()
Definition: MWNamespaceTest.php:580
NS_USER
const NS_USER
Definition: Defines.php:66
MWNamespaceTest\testHasSubpages
testHasSubpages()
MWNamespace::hasSubpages.
Definition: MWNamespaceTest.php:339
MWNamespaceTest\assertIsCapitalized
assertIsCapitalized( $ns)
Definition: MWNamespaceTest.php:444
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:1985
NS_TALK
const NS_TALK
Definition: Defines.php:65
MWNamespaceTest\assertIsTalk
assertIsTalk( $ns)
Definition: MWNamespaceTest.php:62
NS_MEDIAWIKI
const NS_MEDIAWIKI
Definition: Defines.php:72
MWNamespace\isWatchable
static isWatchable( $index)
Can pages in a namespace be watched?
Definition: MWNamespace.php:356
NS_FILE_TALK
const NS_FILE_TALK
Definition: Defines.php:71
MWNamespace\getTalk
static getTalk( $index)
Get the talk namespace index for a given namespace.
Definition: MWNamespace.php:130
NS_CATEGORY_TALK
const NS_CATEGORY_TALK
Definition: Defines.php:79
MWNamespaceTest\testGetTalk
testGetTalk()
Regular getTalk() calls Namespaces without a talk page (NS_MEDIA, NS_SPECIAL) are tested in the funct...
Definition: MWNamespaceTest.php:109
MWNamespace\getSubject
static getSubject( $index)
Get the subject namespace index for a given namespace Special namespaces (NS_MEDIA,...
Definition: MWNamespace.php:144
$wgNamespacesWithSubpages
$wgNamespacesWithSubpages
Which namespaces should support subpages? See Language.php for a list of namespaces.
Definition: DefaultSettings.php:4014
MWNamespaceTest\testGetAssociatedExceptionsForNsSpecial
testGetAssociatedExceptionsForNsSpecial()
MWException MWNamespace::getAssociated.
Definition: MWNamespaceTest.php:162
MWNamespaceTest\testIsContent
testIsContent()
MWNamespace::isContent.
Definition: MWNamespaceTest.php:267
MWNamespace\getAssociated
static getAssociated( $index)
Get the associated namespace.
Definition: MWNamespace.php:163
MWNamespaceTest\testHasGenderDistinction
testHasGenderDistinction()
MWNamespace::hasGenderDistinction.
Definition: MWNamespaceTest.php:548