@covers tags for more test classes

Change-Id: I19d49c279646a4b4c595700e53b790ba4eb9521e
This commit is contained in:
addshore 2013-10-24 20:35:04 +01:00
parent 6c539fc9e6
commit aea1b27db0
13 changed files with 135 additions and 6 deletions

View file

@ -1,5 +1,8 @@
<?php
/**
* @covers MWFunction
*/
class MWFunctionTest extends MediaWikiTestCase {
public function testNewObjFunction() {
$arg1 = 'Foo';

View file

@ -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;
@ -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;

View file

@ -10,6 +10,9 @@ class MessageTest extends MediaWikiLangTestCase {
) );
}
/**
* @covers Message::exists
*/
public function testExists() {
$this->assertTrue( wfMessage( 'mainpage' )->exists() );
$this->assertTrue( wfMessage( 'mainpage' )->params( array() )->exists() );
@ -19,6 +22,9 @@ class MessageTest extends MediaWikiLangTestCase {
$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 @@ class MessageTest extends MediaWikiLangTestCase {
$this->assertEquals( '&lt;i-dont-exist-evar&gt;', 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 @@ class MessageTest extends MediaWikiLangTestCase {
$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 @@ class MessageTest extends MediaWikiLangTestCase {
$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 @@ class MessageTest extends MediaWikiLangTestCase {
$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 @@ class MessageTest extends MediaWikiLangTestCase {
/**
* 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 @@ class MessageTest extends MediaWikiLangTestCase {
);
}
/**
* @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 @@ class MessageTest extends MediaWikiLangTestCase {
/**
* @expectedException MWException
* @covers Message::inLanguage
*/
public function testInLanguageThrows() {
wfMessage( 'foo' )->inLanguage( 123 );

View file

@ -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 @@ class OutputPageTest extends MediaWikiTestCase {
/**
* Tests print requests
* @covers OutputPage::transformCssMedia
*/
public function testPrintRequests() {
$this->assertTransformCssMediaCase( array(
@ -79,6 +82,7 @@ class OutputPageTest extends MediaWikiTestCase {
/**
* Tests screen requests, without either query parameter set
* @covers OutputPage::transformCssMedia
*/
public function testScreenRequests() {
$this->assertTransformCssMediaCase( array(
@ -114,6 +118,7 @@ class OutputPageTest extends MediaWikiTestCase {
/**
* Tests handheld behavior
* @covers OutputPage::transformCssMedia
*/
public function testHandheld() {
$this->assertTransformCssMediaCase( array(

View file

@ -1,10 +1,10 @@
<?php
/**
* Tests for the PathRouter parsing.
*
* @todo Add covers tags.
* @covers PathRouter
*/
class PathRouterTest extends MediaWikiTestCase {
/**

View file

@ -29,6 +29,10 @@
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
* @author Daniel Kinzler
*/
/**
* @covers PageORMTableForTesting
*/
class ORMTableTest extends MediaWikiTestCase {
/**

View file

@ -40,6 +40,9 @@
*/
require_once __DIR__ . "/ORMRowTest.php";
/**
* @covers TestORMRow
*/
class TestORMRowTest extends ORMRowTest {
/**

View file

@ -21,6 +21,9 @@ class MWDebugTest extends MediaWikiTestCase {
parent::tearDown();
}
/**
* @covers MWDebug::log
*/
public function testAddLog() {
MWDebug::log( 'logging a string' );
$this->assertEquals(
@ -33,6 +36,9 @@ class MWDebugTest extends MediaWikiTestCase {
);
}
/**
* @covers MWDebug::warning
*/
public function testAddWarning() {
MWDebug::warning( 'Warning message' );
$this->assertEquals(
@ -45,6 +51,9 @@ class MWDebugTest extends MediaWikiTestCase {
);
}
/**
* @covers MWDebug::deprecated
*/
public function testAvoidDuplicateDeprecations() {
MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
@ -56,6 +65,9 @@ class MWDebugTest extends MediaWikiTestCase {
);
}
/**
* @covers MWDebug::deprecated
*/
public function testAvoidNonConsecutivesDuplicateDeprecations() {
MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
MWDebug::warning( 'some warning' );

View file

@ -70,19 +70,31 @@ class JobQueueTest extends MediaWikiTestCase {
/**
* @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 @@ class JobQueueTest extends MediaWikiTestCase {
/**
* @dataProvider provider_queueLists
* @covers JobQueue
*/
public function testBasicDeduplication( $queue, $recycles, $desc ) {
$queue = $this->$queue;
@ -214,6 +227,7 @@ class JobQueueTest extends MediaWikiTestCase {
/**
* @dataProvider provider_queueLists
* @covers JobQueue
*/
public function testRootDeduplication( $queue, $recycles, $desc ) {
$queue = $this->$queue;
@ -267,6 +281,7 @@ class JobQueueTest extends MediaWikiTestCase {
/**
* @dataProvider provider_fifoQueueLists
* @covers JobQueue
*/
public function testJobOrder( $queue, $recycles, $desc ) {
$queue = $this->$queue;

View file

@ -1,5 +1,8 @@
<?php
/**
* @covers FormatJson
*/
class FormatJsonTest extends MediaWikiTestCase {
public function testEncoderPrettyPrinting() {

View file

@ -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

View file

@ -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.

View file

@ -15,6 +15,9 @@ if ( !defined( 'MEDIAWIKI' ) ) {
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 */