<?php
+/**
+ * @covers MWFunction
+ */
class MWFunctionTest extends MediaWikiTestCase {
public function testNewObjFunction() {
$arg1 = 'Foo';
/**
* 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 {
/**
* @todo Write more texts, handle $wgAllowImageMoving setting
+ * @covers MWNamespace::isMovable
*/
public function testIsMovable() {
$this->assertFalse( MWNamespace::isMovable( NS_CATEGORY ) );
/**
* Please make sure to change testIsTalk() if you change the assertions below
+ * @covers MWNamespace::isSubject
*/
public function testIsSubject() {
// Special namespaces
/**
* Reverse of testIsSubject().
* Please update testIsSubject() if you change assertions below
+ * @covers MWNamespace::isTalk
*/
public function testIsTalk() {
// Special namespaces
}
/**
+ * @covers MWNamespace::getSubject
*/
public function testGetSubject() {
// Special namespaces are their own subjects
* 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 ) );
* 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 ) );
* 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 ) );
* 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 ) );
### an exception for them.
/**
* @expectedException MWException
+ * @covers MWNamespace::getAssociated
*/
public function testGetAssociatedExceptionsForNsMedia() {
$this->assertNull( MWNamespace::getAssociated( NS_MEDIA ) );
/**
* @expectedException MWException
+ * @covers MWNamespace::getAssociated
*/
public function testGetAssociatedExceptionsForNsSpecial() {
$this->assertNull( MWNamespace::getAssociated( NS_SPECIAL ) );
* 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 ) );
}
/**
- * Test MWNamespace::subjectEquals
+ * @covers MWNamespace::subjectEquals
*/
public function testSubjectEquals() {
$this->assertSameSubject( NS_MAIN, NS_MAIN );
$this->assertDifferentSubject( NS_SPECIAL, NS_MAIN );
}
+ /**
+ * @covers MWNamespace::subjectEquals
+ */
public function testSpecialAndMediaAreDifferentSubjects() {
$this->assertDifferentSubject(
NS_MEDIA, NS_SPECIAL,
*/
/**
+ * @covers MWNamespace::canTalk
*/
public function testCanTalk() {
$this->assertCanNotTalk( NS_MEDIA );
}
/**
+ * @covers MWNamespace::isContent
*/
public function testIsContent() {
// NS_MAIN is a content namespace per DefaultSettings.php
/**
* Similar to testIsContent() but alters the $wgContentNamespaces
* global variable.
+ * @covers MWNamespace::isContent
*/
public function testIsContentAdvanced() {
global $wgContentNamespaces;
$this->assertIsContent( NS_MAIN );
}
+ /**
+ * @covers MWNamespace::isWatchable
+ */
public function testIsWatchable() {
// Specials namespaces are not watchable
$this->assertIsNotWatchable( NS_MEDIA );
$this->assertIsWatchable( 101 );
}
+ /**
+ * @covers MWNamespace::hasSubpages
+ */
public function testHasSubpages() {
global $wgNamespacesWithSubpages;
}
/**
+ * @covers MWNamespace::getContentNamespaces
*/
public function testGetContentNamespaces() {
global $wgContentNamespaces;
}
/**
+ * @covers MWNamespace::getSubjectNamespaces
*/
public function testGetSubjectNamespaces() {
$subjectsNS = MWNamespace::getSubjectNamespaces();
}
/**
+ * @covers MWNamespace::getTalkNamespaces
*/
public function testGetTalkNamespaces() {
$talkNS = MWNamespace::getTalkNamespaces();
/**
* 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
*
* 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;
* testing the $wgCapitalLinkOverrides global.
*
* @todo split groups of assertions in autonomous testing functions
+ * @covers MWNamespace::isCapitalized
*/
public function testIsCapitalizedWithWgCapitalLinkOverrides() {
global $wgCapitalLinkOverrides;
$this->assertIsCapitalized( NS_PROJECT );
}
+ /**
+ * @covers MWNamespace::hasGenderDistinction
+ */
public function testHasGenderDistinction() {
// Namespaces with gender distinctions
$this->assertTrue( MWNamespace::hasGenderDistinction( NS_USER ) );
$this->assertFalse( MWNamespace::hasGenderDistinction( NS_TALK ) );
}
+ /**
+ * @covers MWNamespace::isNonincludable
+ */
public function testIsNonincludable() {
global $wgNonincludableNamespaces;
) );
}
+ /**
+ * @covers Message::exists
+ */
public function testExists() {
$this->assertTrue( wfMessage( 'mainpage' )->exists() );
$this->assertTrue( wfMessage( 'mainpage' )->params( array() )->exists() );
$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' ) );
$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() );
$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() );
$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() );
$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
/**
* 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' );
);
}
+ /**
+ * @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' ),
/**
* @expectedException MWException
+ * @covers Message::inLanguage
*/
public function testInLanguageThrows() {
wfMessage( 'foo' )->inLanguage( 123 );
*
* @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)';
/**
* Tests print requests
+ * @covers OutputPage::transformCssMedia
*/
public function testPrintRequests() {
$this->assertTransformCssMediaCase( array(
/**
* Tests screen requests, without either query parameter set
+ * @covers OutputPage::transformCssMedia
*/
public function testScreenRequests() {
$this->assertTransformCssMediaCase( array(
/**
* Tests handheld behavior
+ * @covers OutputPage::transformCssMedia
*/
public function testHandheld() {
$this->assertTransformCssMediaCase( array(
<?php
+
/**
* Tests for the PathRouter parsing.
*
- * @todo Add covers tags.
+ * @covers PathRouter
*/
-
class PathRouterTest extends MediaWikiTestCase {
/**
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
* @author Daniel Kinzler
*/
+
+/**
+ * @covers PageORMTableForTesting
+ */
class ORMTableTest extends MediaWikiTestCase {
/**
*/
require_once __DIR__ . "/ORMRowTest.php";
+/**
+ * @covers TestORMRow
+ */
class TestORMRowTest extends ORMRowTest {
/**
parent::tearDown();
}
+ /**
+ * @covers MWDebug::log
+ */
public function testAddLog() {
MWDebug::log( 'logging a string' );
$this->assertEquals(
);
}
+ /**
+ * @covers MWDebug::warning
+ */
public function testAddWarning() {
MWDebug::warning( 'Warning message' );
$this->assertEquals(
);
}
+ /**
+ * @covers MWDebug::deprecated
+ */
public function testAvoidDuplicateDeprecations() {
MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
);
}
+ /**
+ * @covers MWDebug::deprecated
+ */
public function testAvoidNonConsecutivesDuplicateDeprecations() {
MWDebug::deprecated( 'wfOldFunction', '1.0', 'component' );
MWDebug::warning( 'some warning' );
/**
* @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;
/**
* @dataProvider provider_queueLists
+ * @covers JobQueue
*/
public function testBasicDeduplication( $queue, $recycles, $desc ) {
$queue = $this->$queue;
/**
* @dataProvider provider_queueLists
+ * @covers JobQueue
*/
public function testRootDeduplication( $queue, $recycles, $desc ) {
$queue = $this->$queue;
/**
* @dataProvider provider_fifoQueueLists
+ * @covers JobQueue
*/
public function testJobOrder( $queue, $recycles, $desc ) {
$queue = $this->$queue;
<?php
+/**
+ * @covers FormatJson
+ */
class FormatJsonTest extends MediaWikiTestCase {
public function testEncoderPrettyPrinting() {
* @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
/**
* @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.
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 */