X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FMWNamespaceTest.php;h=b6fa139fb168a3ff12ed105e9297b261c619b77a;hb=9ea365dcb2f1390e117767e0ead4a5655ad4631d;hp=7d6d5a1f510247ba3be120ebf66c6d0e053331d7;hpb=7cc8df605ed4c94bbb5be7f83755b4418485e9f4;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/MWNamespaceTest.php b/tests/phpunit/includes/MWNamespaceTest.php index 7d6d5a1f51..b6fa139fb1 100644 --- a/tests/phpunit/includes/MWNamespaceTest.php +++ b/tests/phpunit/includes/MWNamespaceTest.php @@ -8,6 +8,8 @@ /** * Test class for MWNamespace. * Generated by PHPUnit on 2011-02-20 at 21:01:55. + * @todo covers tags + * @FIXME this test file is a mess * */ class MWNamespaceTest extends MediaWikiTestCase { @@ -31,6 +33,7 @@ class MWNamespaceTest extends MediaWikiTestCase { /** * @todo Write more texts, handle $wgAllowImageMoving setting + * @covers MWNamespace::isMovable */ public function testIsMovable() { $this->assertFalse( MWNamespace::isMovable( NS_CATEGORY ) ); @@ -39,6 +42,7 @@ class MWNamespaceTest extends MediaWikiTestCase { /** * Please make sure to change testIsTalk() if you change the assertions below + * @covers MWNamespace::isSubject */ public function testIsSubject() { // Special namespaces @@ -59,6 +63,7 @@ class MWNamespaceTest extends MediaWikiTestCase { /** * Reverse of testIsSubject(). * Please update testIsSubject() if you change assertions below + * @covers MWNamespace::isTalk */ public function testIsTalk() { // Special namespaces @@ -77,6 +82,7 @@ class MWNamespaceTest extends MediaWikiTestCase { } /** + * @covers MWNamespace::getSubject */ public function testGetSubject() { // Special namespaces are their own subjects @@ -91,6 +97,7 @@ class MWNamespaceTest extends MediaWikiTestCase { * Regular getTalk() calls * Namespaces without a talk page (NS_MEDIA, NS_SPECIAL) are tested in * the function testGetTalkExceptions() + * @covers MWNamespace::getTalk */ public function testGetTalk() { $this->assertEquals( NS_TALK, MWNamespace::getTalk( NS_MAIN ) ); @@ -103,6 +110,7 @@ class MWNamespaceTest extends MediaWikiTestCase { * Exceptions with getTalk() * NS_MEDIA does not have talk pages. MediaWiki raise an exception for them. * @expectedException MWException + * @covers MWNamespace::getTalk */ public function testGetTalkExceptionsForNsMedia() { $this->assertNull( MWNamespace::getTalk( NS_MEDIA ) ); @@ -112,6 +120,7 @@ class MWNamespaceTest extends MediaWikiTestCase { * Exceptions with getTalk() * NS_SPECIAL does not have talk pages. MediaWiki raise an exception for them. * @expectedException MWException + * @covers MWNamespace::getTalk */ public function testGetTalkExceptionsForNsSpecial() { $this->assertNull( MWNamespace::getTalk( NS_SPECIAL ) ); @@ -121,6 +130,7 @@ class MWNamespaceTest extends MediaWikiTestCase { * Regular getAssociated() calls * Namespaces without an associated page (NS_MEDIA, NS_SPECIAL) are tested in * the function testGetAssociatedExceptions() + * @covers MWNamespace::getAssociated */ public function testGetAssociated() { $this->assertEquals( NS_TALK, MWNamespace::getAssociated( NS_MAIN ) ); @@ -132,6 +142,7 @@ class MWNamespaceTest extends MediaWikiTestCase { ### an exception for them. /** * @expectedException MWException + * @covers MWNamespace::getAssociated */ public function testGetAssociatedExceptionsForNsMedia() { $this->assertNull( MWNamespace::getAssociated( NS_MEDIA ) ); @@ -139,6 +150,7 @@ class MWNamespaceTest extends MediaWikiTestCase { /** * @expectedException MWException + * @covers MWNamespace::getAssociated */ public function testGetAssociatedExceptionsForNsSpecial() { $this->assertNull( MWNamespace::getAssociated( NS_SPECIAL ) ); @@ -161,6 +173,7 @@ class MWNamespaceTest extends MediaWikiTestCase { * Note if we add a namespace registration system with keys like 'MAIN' * we should add tests here for equivilance on things like 'MAIN' == 0 * and 'MAIN' == NS_MAIN. + * @covers MWNamespace::equals */ public function testEquals() { $this->assertTrue( MWNamespace::equals( NS_MAIN, NS_MAIN ) ); @@ -175,7 +188,7 @@ class MWNamespaceTest extends MediaWikiTestCase { } /** - * Test MWNamespace::subjectEquals + * @covers MWNamespace::subjectEquals */ public function testSubjectEquals() { $this->assertSameSubject( NS_MAIN, NS_MAIN ); @@ -191,6 +204,9 @@ class MWNamespaceTest extends MediaWikiTestCase { $this->assertDifferentSubject( NS_SPECIAL, NS_MAIN ); } + /** + * @covers MWNamespace::subjectEquals + */ public function testSpecialAndMediaAreDifferentSubjects() { $this->assertDifferentSubject( NS_MEDIA, NS_SPECIAL, @@ -249,6 +265,7 @@ class MWNamespaceTest extends MediaWikiTestCase { */ /** + * @covers MWNamespace::canTalk */ public function testCanTalk() { $this->assertCanNotTalk( NS_MEDIA ); @@ -265,6 +282,7 @@ class MWNamespaceTest extends MediaWikiTestCase { } /** + * @covers MWNamespace::isContent */ public function testIsContent() { // NS_MAIN is a content namespace per DefaultSettings.php @@ -285,6 +303,7 @@ class MWNamespaceTest extends MediaWikiTestCase { /** * Similar to testIsContent() but alters the $wgContentNamespaces * global variable. + * @covers MWNamespace::isContent */ public function testIsContentAdvanced() { global $wgContentNamespaces; @@ -301,6 +320,9 @@ class MWNamespaceTest extends MediaWikiTestCase { $this->assertIsContent( NS_MAIN ); } + /** + * @covers MWNamespace::isWatchable + */ public function testIsWatchable() { // Specials namespaces are not watchable $this->assertIsNotWatchable( NS_MEDIA ); @@ -315,6 +337,9 @@ class MWNamespaceTest extends MediaWikiTestCase { $this->assertIsWatchable( 101 ); } + /** + * @covers MWNamespace::hasSubpages + */ public function testHasSubpages() { global $wgNamespacesWithSubpages; @@ -338,6 +363,7 @@ class MWNamespaceTest extends MediaWikiTestCase { } /** + * @covers MWNamespace::getContentNamespaces */ public function testGetContentNamespaces() { global $wgContentNamespaces; @@ -350,20 +376,20 @@ class MWNamespaceTest extends MediaWikiTestCase { # test !is_array( $wgcontentNamespaces ) $wgContentNamespaces = ''; - $this->assertEquals( NS_MAIN, MWNamespace::getContentNamespaces() ); + $this->assertEquals( array( NS_MAIN ), MWNamespace::getContentNamespaces() ); $wgContentNamespaces = false; - $this->assertEquals( NS_MAIN, MWNamespace::getContentNamespaces() ); + $this->assertEquals( array( NS_MAIN ), MWNamespace::getContentNamespaces() ); $wgContentNamespaces = null; - $this->assertEquals( NS_MAIN, MWNamespace::getContentNamespaces() ); + $this->assertEquals( array( NS_MAIN ), MWNamespace::getContentNamespaces() ); $wgContentNamespaces = 5; - $this->assertEquals( NS_MAIN, MWNamespace::getContentNamespaces() ); + $this->assertEquals( array( NS_MAIN ), MWNamespace::getContentNamespaces() ); # test $wgContentNamespaces === array() $wgContentNamespaces = array(); - $this->assertEquals( NS_MAIN, MWNamespace::getContentNamespaces() ); + $this->assertEquals( array( NS_MAIN ), MWNamespace::getContentNamespaces() ); # test !in_array( NS_MAIN, $wgContentNamespaces ) $wgContentNamespaces = array( NS_USER, NS_CATEGORY ); @@ -388,6 +414,7 @@ class MWNamespaceTest extends MediaWikiTestCase { } /** + * @covers MWNamespace::getSubjectNamespaces */ public function testGetSubjectNamespaces() { $subjectsNS = MWNamespace::getSubjectNamespaces(); @@ -403,6 +430,7 @@ class MWNamespaceTest extends MediaWikiTestCase { } /** + * @covers MWNamespace::getTalkNamespaces */ public function testGetTalkNamespaces() { $talkNS = MWNamespace::getTalkNamespaces(); @@ -420,6 +448,7 @@ class MWNamespaceTest extends MediaWikiTestCase { /** * Some namespaces are always capitalized per code definition * in MWNamespace::$alwaysCapitalizedNamespaces + * @covers MWNamespace::isCapitalized */ public function testIsCapitalizedHardcodedAssertions() { // NS_MEDIA and NS_FILE are treated the same @@ -451,6 +480,7 @@ class MWNamespaceTest extends MediaWikiTestCase { * * Global setting correctness is tested against the NS_PROJECT and * NS_PROJECT_TALK namespaces since they are not hardcoded nor specials + * @covers MWNamespace::isCapitalized */ public function testIsCapitalizedWithWgCapitalLinks() { global $wgCapitalLinks; @@ -475,6 +505,7 @@ class MWNamespaceTest extends MediaWikiTestCase { * testing the $wgCapitalLinkOverrides global. * * @todo split groups of assertions in autonomous testing functions + * @covers MWNamespace::isCapitalized */ public function testIsCapitalizedWithWgCapitalLinkOverrides() { global $wgCapitalLinkOverrides; @@ -507,6 +538,9 @@ class MWNamespaceTest extends MediaWikiTestCase { $this->assertIsCapitalized( NS_PROJECT ); } + /** + * @covers MWNamespace::hasGenderDistinction + */ public function testHasGenderDistinction() { // Namespaces with gender distinctions $this->assertTrue( MWNamespace::hasGenderDistinction( NS_USER ) ); @@ -519,6 +553,9 @@ class MWNamespaceTest extends MediaWikiTestCase { $this->assertFalse( MWNamespace::hasGenderDistinction( NS_TALK ) ); } + /** + * @covers MWNamespace::isNonincludable + */ public function testIsNonincludable() { global $wgNonincludableNamespaces;