Mwalker has submitted this change and it was merged.
Change subject: @covers tags for more test classes
......................................................................
@covers tags for more test classes
Change-Id: I19d49c279646a4b4c595700e53b790ba4eb9521e
---
M tests/phpunit/includes/MWFunctionTest.php
M tests/phpunit/includes/MWNamespaceTest.php
M tests/phpunit/includes/MessageTest.php
M tests/phpunit/includes/OutputPageTest.php
M tests/phpunit/includes/PathRouterTest.php
M tests/phpunit/includes/db/ORMTableTest.php
M tests/phpunit/includes/db/TestORMRowTest.php
M tests/phpunit/includes/debug/MWDebugTest.php
M tests/phpunit/includes/jobqueue/JobQueueTest.php
M tests/phpunit/includes/json/FormatJsonTest.php
M tests/phpunit/includes/normal/CleanUpTest.php
M tests/phpunit/includes/search/SearchEngineTest.php
M tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php
13 files changed, 135 insertions(+), 6 deletions(-)
Approvals:
Mwalker: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/phpunit/includes/MWFunctionTest.php
b/tests/phpunit/includes/MWFunctionTest.php
index d86f2c9..f2a720e 100644
--- a/tests/phpunit/includes/MWFunctionTest.php
+++ b/tests/phpunit/includes/MWFunctionTest.php
@@ -1,5 +1,8 @@
<?php
+/**
+ * @covers MWFunction
+ */
class MWFunctionTest extends MediaWikiTestCase {
public function testNewObjFunction() {
$arg1 = 'Foo';
diff --git a/tests/phpunit/includes/MWNamespaceTest.php
b/tests/phpunit/includes/MWNamespaceTest.php
index 10e9db6..b6fa139 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 @@
/**
* @todo Write more texts, handle $wgAllowImageMoving setting
+ * @covers MWNamespace::isMovable
*/
public function testIsMovable() {
$this->assertFalse( MWNamespace::isMovable( NS_CATEGORY ) );
@@ -39,6 +42,7 @@
/**
* Please make sure to change testIsTalk() if you change the assertions
below
+ * @covers MWNamespace::isSubject
*/
public function testIsSubject() {
// Special namespaces
@@ -59,6 +63,7 @@
/**
* Reverse of testIsSubject().
* Please update testIsSubject() if you change assertions below
+ * @covers MWNamespace::isTalk
*/
public function testIsTalk() {
// Special namespaces
@@ -77,6 +82,7 @@
}
/**
+ * @covers MWNamespace::getSubject
*/
public function testGetSubject() {
// Special namespaces are their own subjects
@@ -91,6 +97,7 @@
* 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 @@
* 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 @@
* 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 @@
* 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 @@
### an exception for them.
/**
* @expectedException MWException
+ * @covers MWNamespace::getAssociated
*/
public function testGetAssociatedExceptionsForNsMedia() {
$this->assertNull( MWNamespace::getAssociated( NS_MEDIA ) );
@@ -139,6 +150,7 @@
/**
* @expectedException MWException
+ * @covers MWNamespace::getAssociated
*/
public function testGetAssociatedExceptionsForNsSpecial() {
$this->assertNull( MWNamespace::getAssociated( NS_SPECIAL ) );
@@ -161,6 +173,7 @@
* 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 @@
}
/**
- * Test MWNamespace::subjectEquals
+ * @covers MWNamespace::subjectEquals
*/
public function testSubjectEquals() {
$this->assertSameSubject( NS_MAIN, NS_MAIN );
@@ -191,6 +204,9 @@
$this->assertDifferentSubject( NS_SPECIAL, NS_MAIN );
}
+ /**
+ * @covers MWNamespace::subjectEquals
+ */
public function testSpecialAndMediaAreDifferentSubjects() {
$this->assertDifferentSubject(
NS_MEDIA, NS_SPECIAL,
@@ -249,6 +265,7 @@
*/
/**
+ * @covers MWNamespace::canTalk
*/
public function testCanTalk() {
$this->assertCanNotTalk( NS_MEDIA );
@@ -265,6 +282,7 @@
}
/**
+ * @covers MWNamespace::isContent
*/
public function testIsContent() {
// NS_MAIN is a content namespace per DefaultSettings.php
@@ -285,6 +303,7 @@
/**
* Similar to testIsContent() but alters the $wgContentNamespaces
* global variable.
+ * @covers MWNamespace::isContent
*/
public function testIsContentAdvanced() {
global $wgContentNamespaces;
@@ -301,6 +320,9 @@
$this->assertIsContent( NS_MAIN );
}
+ /**
+ * @covers MWNamespace::isWatchable
+ */
public function testIsWatchable() {
// Specials namespaces are not watchable
$this->assertIsNotWatchable( NS_MEDIA );
@@ -315,6 +337,9 @@
$this->assertIsWatchable( 101 );
}
+ /**
+ * @covers MWNamespace::hasSubpages
+ */
public function testHasSubpages() {
global $wgNamespacesWithSubpages;
@@ -338,6 +363,7 @@
}
/**
+ * @covers MWNamespace::getContentNamespaces
*/
public function testGetContentNamespaces() {
global $wgContentNamespaces;
@@ -388,6 +414,7 @@
}
/**
+ * @covers MWNamespace::getSubjectNamespaces
*/
public function testGetSubjectNamespaces() {
$subjectsNS = MWNamespace::getSubjectNamespaces();
@@ -403,6 +430,7 @@
}
/**
+ * @covers MWNamespace::getTalkNamespaces
*/
public function testGetTalkNamespaces() {
$talkNS = MWNamespace::getTalkNamespaces();
@@ -420,6 +448,7 @@
/**
* 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 @@
*
* 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 @@
* 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 @@
$this->assertIsCapitalized( NS_PROJECT );
}
+ /**
+ * @covers MWNamespace::hasGenderDistinction
+ */
public function testHasGenderDistinction() {
// Namespaces with gender distinctions
$this->assertTrue( MWNamespace::hasGenderDistinction( NS_USER )
);
@@ -519,6 +553,9 @@
$this->assertFalse( MWNamespace::hasGenderDistinction( NS_TALK
) );
}
+ /**
+ * @covers MWNamespace::isNonincludable
+ */
public function testIsNonincludable() {
global $wgNonincludableNamespaces;
diff --git a/tests/phpunit/includes/MessageTest.php
b/tests/phpunit/includes/MessageTest.php
index 1e18f97..71ebd6a 100644
--- a/tests/phpunit/includes/MessageTest.php
+++ b/tests/phpunit/includes/MessageTest.php
@@ -10,6 +10,9 @@
) );
}
+ /**
+ * @covers Message::exists
+ */
public function testExists() {
$this->assertTrue( wfMessage( 'mainpage' )->exists() );
$this->assertTrue( wfMessage( 'mainpage' )->params( array()
)->exists() );
@@ -19,6 +22,9 @@
$this->assertFalse( wfMessage( 'i-dont-exist-evar'
)->rawParams( 'foo', 123 )->exists() );
}
+ /**
+ * @covers Message::__construct
+ */
public function testKey() {
$this->assertInstanceOf( 'Message', wfMessage( 'mainpage' ) );
$this->assertInstanceOf( 'Message', wfMessage(
'i-dont-exist-evar' ) );
@@ -28,6 +34,9 @@
$this->assertEquals( '<i-dont-exist-evar>', wfMessage(
'i-dont-exist-evar' )->escaped() );
}
+ /**
+ * @covers Message::inLanguage
+ */
public function testInLanguage() {
$this->assertEquals( 'Main Page', wfMessage( 'mainpage'
)->inLanguage( 'en' )->text() );
$this->assertEquals( 'Заглавная страница', wfMessage(
'mainpage' )->inLanguage( 'ru' )->text() );
@@ -35,6 +44,9 @@
$this->assertEquals( 'Заглавная страница', wfMessage(
'mainpage' )->inLanguage( Language::factory( 'ru' ) )->text() );
}
+ /**
+ * @covers Message::__construct
+ */
public function testMessageParams() {
$this->assertEquals( 'Return to $1.', wfMessage( 'returnto'
)->text() );
$this->assertEquals( 'Return to $1.', wfMessage( 'returnto',
array() )->text() );
@@ -42,6 +54,10 @@
$this->assertEquals( 'You have foo (bar).', wfMessage(
'youhavenewmessages', array( 'foo', 'bar' ) )->text() );
}
+ /**
+ * @covers Message::__construct
+ * @covers Message::rawParams
+ */
public function testMessageParamSubstitution() {
$this->assertEquals( '(Заглавная страница)', wfMessage(
'parentheses', 'Заглавная страница' )->plain() );
$this->assertEquals( '(Заглавная страница $1)', wfMessage(
'parentheses', 'Заглавная страница $1' )->plain() );
@@ -49,6 +65,10 @@
$this->assertEquals( '(Заглавная страница $1)', wfMessage(
'parentheses' )->rawParams( 'Заглавная страница $1' )->plain() );
}
+ /**
+ * @covers Message::__construct
+ * @covers Message::params
+ */
public function testDeliciouslyManyParams() {
$msg = new RawMessage( '$1$2$3$4$5$6$7$8$9$10$11$12' );
// One less than above has placeholders
@@ -59,6 +79,13 @@
/**
* FIXME: This should not need database, but Language#formatExpiry does
(bug 55912)
* @group Database
+ * @todo this should be split up into multiple test methods
+ * @covers Message::numParams
+ * @covers Message::durationParams
+ * @covers Message::expiryParams
+ * @covers Message::timeperiodParams
+ * @covers Message::sizeParams
+ * @covers Message::bitrateParams
*/
public function testMessageParamTypes() {
$lang = Language::factory( 'en' );
@@ -106,12 +133,18 @@
);
}
+ /**
+ * @covers Message::inContentLanguage
+ */
public function testInContentLanguageDisabled() {
$this->setMwGlobals( 'wgLang', Language::factory( 'fr' ) );
$this->assertEquals( 'Main Page', wfMessage( 'mainpage'
)->inContentLanguage()->plain(), 'ForceUIMsg disabled' );
}
+ /**
+ * @covers Message::inContentLanguage
+ */
public function testInContentLanguageEnabled() {
$this->setMwGlobals( array(
'wgLang' => Language::factory( 'fr' ),
@@ -123,6 +156,7 @@
/**
* @expectedException MWException
+ * @covers Message::inLanguage
*/
public function testInLanguageThrows() {
wfMessage( 'foo' )->inLanguage( 123 );
diff --git a/tests/phpunit/includes/OutputPageTest.php
b/tests/phpunit/includes/OutputPageTest.php
index 56bb0fc..385cee5 100644
--- a/tests/phpunit/includes/OutputPageTest.php
+++ b/tests/phpunit/includes/OutputPageTest.php
@@ -6,6 +6,8 @@
*
* @group Output
*
+ * @todo factor tests in this class into providers and test methods
+ *
*/
class OutputPageTest extends MediaWikiTestCase {
const SCREEN_MEDIA_QUERY = 'screen and (min-width: 982px)';
@@ -46,6 +48,7 @@
/**
* Tests print requests
+ * @covers OutputPage::transformCssMedia
*/
public function testPrintRequests() {
$this->assertTransformCssMediaCase( array(
@@ -79,6 +82,7 @@
/**
* Tests screen requests, without either query parameter set
+ * @covers OutputPage::transformCssMedia
*/
public function testScreenRequests() {
$this->assertTransformCssMediaCase( array(
@@ -114,6 +118,7 @@
/**
* Tests handheld behavior
+ * @covers OutputPage::transformCssMedia
*/
public function testHandheld() {
$this->assertTransformCssMediaCase( array(
diff --git a/tests/phpunit/includes/PathRouterTest.php
b/tests/phpunit/includes/PathRouterTest.php
index adfb215..8fea8cc 100644
--- a/tests/phpunit/includes/PathRouterTest.php
+++ b/tests/phpunit/includes/PathRouterTest.php
@@ -1,10 +1,10 @@
<?php
+
/**
* Tests for the PathRouter parsing.
*
- * @todo Add covers tags.
+ * @covers PathRouter
*/
-
class PathRouterTest extends MediaWikiTestCase {
/**
diff --git a/tests/phpunit/includes/db/ORMTableTest.php
b/tests/phpunit/includes/db/ORMTableTest.php
index e583d1b..7171ee5 100644
--- a/tests/phpunit/includes/db/ORMTableTest.php
+++ b/tests/phpunit/includes/db/ORMTableTest.php
@@ -29,6 +29,10 @@
* @author Jeroen De Dauw < [email protected] >
* @author Daniel Kinzler
*/
+
+/**
+ * @covers PageORMTableForTesting
+ */
class ORMTableTest extends MediaWikiTestCase {
/**
diff --git a/tests/phpunit/includes/db/TestORMRowTest.php
b/tests/phpunit/includes/db/TestORMRowTest.php
index f65642b..c9459c9 100644
--- a/tests/phpunit/includes/db/TestORMRowTest.php
+++ b/tests/phpunit/includes/db/TestORMRowTest.php
@@ -40,6 +40,9 @@
*/
require_once __DIR__ . "/ORMRowTest.php";
+/**
+ * @covers TestORMRow
+ */
class TestORMRowTest extends ORMRowTest {
/**
diff --git a/tests/phpunit/includes/debug/MWDebugTest.php
b/tests/phpunit/includes/debug/MWDebugTest.php
index 6926b1c..df73000 100644
--- a/tests/phpunit/includes/debug/MWDebugTest.php
+++ b/tests/phpunit/includes/debug/MWDebugTest.php
@@ -21,6 +21,9 @@
parent::tearDown();
}
+ /**
+ * @covers MWDebug::log
+ */
public function testAddLog() {
MWDebug::log( 'logging a string' );
$this->assertEquals(
@@ -33,6 +36,9 @@
);
}
+ /**
+ * @covers MWDebug::warning
+ */
public function testAddWarning() {
MWDebug::warning( 'Warning message' );
$this->assertEquals(
@@ -45,6 +51,9 @@
);
}
+ /**
+ * @covers MWDebug::deprecated
+ */
public function testAvoidDuplicateDeprecations() {
MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
@@ -56,6 +65,9 @@
);
}
+ /**
+ * @covers MWDebug::deprecated
+ */
public function testAvoidNonConsecutivesDuplicateDeprecations() {
MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
MWDebug::warning( 'some warning' );
diff --git a/tests/phpunit/includes/jobqueue/JobQueueTest.php
b/tests/phpunit/includes/jobqueue/JobQueueTest.php
index 4e51c4f..3319490 100644
--- a/tests/phpunit/includes/jobqueue/JobQueueTest.php
+++ b/tests/phpunit/includes/jobqueue/JobQueueTest.php
@@ -70,19 +70,31 @@
/**
* @dataProvider provider_queueLists
+ * @covers JobQueue::getWiki
*/
- public function testProperties( $queue, $recycles, $desc ) {
+ public function testGetWiki( $queue, $recycles, $desc ) {
$queue = $this->$queue;
if ( !$queue ) {
$this->markTestSkipped( $desc );
}
-
$this->assertEquals( wfWikiID(), $queue->getWiki(), "Proper
wiki ID ($desc)" );
+ }
+
+ /**
+ * @dataProvider provider_queueLists
+ * @covers JobQueue::getType
+ */
+ public function testGetType( $queue, $recycles, $desc ) {
+ $queue = $this->$queue;
+ if ( !$queue ) {
+ $this->markTestSkipped( $desc );
+ }
$this->assertEquals( 'null', $queue->getType(), "Proper job
type ($desc)" );
}
/**
* @dataProvider provider_queueLists
+ * @covers JobQueue
*/
public function testBasicOperations( $queue, $recycles, $desc ) {
$queue = $this->$queue;
@@ -157,6 +169,7 @@
/**
* @dataProvider provider_queueLists
+ * @covers JobQueue
*/
public function testBasicDeduplication( $queue, $recycles, $desc ) {
$queue = $this->$queue;
@@ -214,6 +227,7 @@
/**
* @dataProvider provider_queueLists
+ * @covers JobQueue
*/
public function testRootDeduplication( $queue, $recycles, $desc ) {
$queue = $this->$queue;
@@ -267,6 +281,7 @@
/**
* @dataProvider provider_fifoQueueLists
+ * @covers JobQueue
*/
public function testJobOrder( $queue, $recycles, $desc ) {
$queue = $this->$queue;
diff --git a/tests/phpunit/includes/json/FormatJsonTest.php
b/tests/phpunit/includes/json/FormatJsonTest.php
index eb024ab..3eeaaed 100644
--- a/tests/phpunit/includes/json/FormatJsonTest.php
+++ b/tests/phpunit/includes/json/FormatJsonTest.php
@@ -1,5 +1,8 @@
<?php
+/**
+ * @covers FormatJson
+ */
class FormatJsonTest extends MediaWikiTestCase {
public function testEncoderPrettyPrinting() {
diff --git a/tests/phpunit/includes/normal/CleanUpTest.php
b/tests/phpunit/includes/normal/CleanUpTest.php
index 52dd2ef..a495700 100644
--- a/tests/phpunit/includes/normal/CleanUpTest.php
+++ b/tests/phpunit/includes/normal/CleanUpTest.php
@@ -31,6 +31,9 @@
* @ingroup UtfNormal
* @group Large
*
+ * @todo covers tags, will be UtfNormal::cleanUp once the below is resolved
+ * @todo split me into test methods and providers per the below comment
+ *
* We ignore code coverage for this test suite until they are rewritten
* to use data providers (bug 46561).
* @codeCoverageIgnore
diff --git a/tests/phpunit/includes/search/SearchEngineTest.php
b/tests/phpunit/includes/search/SearchEngineTest.php
index 8706703..e460591 100644
--- a/tests/phpunit/includes/search/SearchEngineTest.php
+++ b/tests/phpunit/includes/search/SearchEngineTest.php
@@ -3,9 +3,16 @@
/**
* @group Search
* @group Database
+ *
+ * @covers SearchEngine<extended>
+ * @note Coverage will only ever show one of on of the Search* classes
*/
class SearchEngineTest extends MediaWikiLangTestCase {
- protected $search, $pageList;
+ /**
+ * @var SearchEngine
+ */
+ protected $search;
+ protected $pageList;
/**
* Checks for database type & version.
diff --git a/tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php
b/tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php
index a806b4a..ba845eb 100644
--- a/tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php
+++ b/tests/phpunit/includes/specials/QueryAllSpecialPagesTest.php
@@ -15,6 +15,9 @@
global $IP;
require_once "$IP/includes/QueryPage.php"; // Needed to populate $wgQueryPages
+/**
+ * @covers QueryPage<extended>
+ */
class QueryAllSpecialPagesTest extends MediaWikiTestCase {
/** List query pages that can not be tested automatically */
--
To view, visit https://gerrit.wikimedia.org/r/91660
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I19d49c279646a4b4c595700e53b790ba4eb9521e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Mwalker <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits