From: addshore Date: Thu, 24 Oct 2013 10:54:02 +0000 (+0100) Subject: @covers tags for inclues/*Test X-Git-Tag: 1.31.0-rc.0~18411^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=9c540db2df03b2b689a7237a84ac1aaa78e92dba;p=lhc%2Fweb%2Fwiklou.git @covers tags for inclues/*Test Change-Id: Id28acdd8fe0028bf1e46344cfed131076c8f4c95 --- diff --git a/tests/phpunit/includes/ArticleTablesTest.php b/tests/phpunit/includes/ArticleTablesTest.php index 0f159ae42b..c749598cff 100644 --- a/tests/phpunit/includes/ArticleTablesTest.php +++ b/tests/phpunit/includes/ArticleTablesTest.php @@ -5,6 +5,10 @@ */ class ArticleTablesTest extends MediaWikiLangTestCase { + /** + * @covers Title::getTemplateLinksFrom + * @covers Title::getLinksFrom + */ public function testbug14404() { global $wgContLang, $wgLanguageCode, $wgLang; diff --git a/tests/phpunit/includes/ArticleTest.php b/tests/phpunit/includes/ArticleTest.php index b4d6dca6d4..84f900fd37 100644 --- a/tests/phpunit/includes/ArticleTest.php +++ b/tests/phpunit/includes/ArticleTest.php @@ -25,12 +25,16 @@ class ArticleTest extends MediaWikiTestCase { $this->article = null; } + /** + * @covers Article::__get + */ public function testImplementsGetMagic() { $this->assertEquals( false, $this->article->mLatest, "Article __get magic" ); } /** * @depends testImplementsGetMagic + * @covers Article::__set */ public function testImplementsSetMagic() { $this->article->mLatest = 2; @@ -39,6 +43,7 @@ class ArticleTest extends MediaWikiTestCase { /** * @depends testImplementsSetMagic + * @covers Article::__call */ public function testImplementsCallMagic() { $this->article->mLatest = 33; @@ -46,6 +51,10 @@ class ArticleTest extends MediaWikiTestCase { $this->assertEquals( 33, $this->article->getLatest(), "Article __call magic" ); } + /** + * @covers Article::__get + * @covers Article::__set + */ public function testGetOrSetOnNewProperty() { $this->article->ext_someNewProperty = 12; $this->assertEquals( 12, $this->article->ext_someNewProperty, @@ -58,6 +67,11 @@ class ArticleTest extends MediaWikiTestCase { /** * Checks for the existence of the backwards compatibility static functions (forwarders to WikiPage class) + * @covers Article::selectFields + * @covers Article::onArticleCreate + * @covers Article::onArticleDelete + * @covers Article::onArticleEdit + * @covers Article::getAutosummary */ public function testStaticFunctions() { $this->hideDeprecated( 'Article::getAutosummary' ); @@ -75,18 +89,4 @@ class ArticleTest extends MediaWikiTestCase { $this->assertTrue( is_string( CategoryPage::getAutosummary( '', '', 0 ) ), "Article static functions" ); } - - public function testWikiPageFactory() { - $title = Title::makeTitle( NS_FILE, 'Someimage.png' ); - $page = WikiPage::factory( $title ); - $this->assertEquals( 'WikiFilePage', get_class( $page ) ); - - $title = Title::makeTitle( NS_CATEGORY, 'SomeCategory' ); - $page = WikiPage::factory( $title ); - $this->assertEquals( 'WikiCategoryPage', get_class( $page ) ); - - $title = Title::makeTitle( NS_MAIN, 'SomePage' ); - $page = WikiPage::factory( $title ); - $this->assertEquals( 'WikiPage', get_class( $page ) ); - } } diff --git a/tests/phpunit/includes/BlockTest.php b/tests/phpunit/includes/BlockTest.php index 21de098549..f0049fec7b 100644 --- a/tests/phpunit/includes/BlockTest.php +++ b/tests/phpunit/includes/BlockTest.php @@ -6,7 +6,9 @@ */ class BlockTest extends MediaWikiLangTestCase { - private $block, $madeAt; + /** @var Block */ + private $block; + private $madeAt; /* variable used to save up the blockID we insert in this test suite */ private $blockId; @@ -66,11 +68,17 @@ class BlockTest extends MediaWikiLangTestCase { } } - public function testInitializerFunctionsReturnCorrectBlock() { - // $this->dumpBlocks(); - + /** + * @covers Block::newFromTarget + */ + public function testINewFromTargetReturnsCorrectBlock() { $this->assertTrue( $this->block->equals( Block::newFromTarget( 'UTBlockee' ) ), "newFromTarget() returns the same block as the one that was made" ); + } + /** + * @covers Block::newFromID + */ + public function testINewFromIDReturnsCorrectBlock() { $this->assertTrue( $this->block->equals( Block::newFromID( $this->blockId ) ), "newFromID() returns the same block as the one that was made" ); } @@ -90,6 +98,7 @@ class BlockTest extends MediaWikiLangTestCase { * This stopped working with r84475 and friends: regression being fixed for bug 29116. * * @dataProvider provideBug29116Data + * @covers Block::load */ public function testBug29116LoadWithEmptyIp( $vagueTarget ) { $this->hideDeprecated( 'Block::load' ); @@ -110,6 +119,7 @@ class BlockTest extends MediaWikiLangTestCase { * had. Regression bug 29116. * * @dataProvider provideBug29116Data + * @covers Block::newFromTarget */ public function testBug29116NewFromTargetWithEmptyIp( $vagueTarget ) { $block = Block::newFromTarget( 'UTBlockee', $vagueTarget ); @@ -124,6 +134,9 @@ class BlockTest extends MediaWikiLangTestCase { ); } + /** + * @covers Block::prevents + */ public function testBlockedUserCanNotCreateAccount() { $username = 'BlockedUserToCreateAccountWith'; $u = User::newFromName( $username ); @@ -184,6 +197,9 @@ class BlockTest extends MediaWikiLangTestCase { ); } + /** + * @covers Block::insert + */ public function testCrappyCrossWikiBlocks() { // Delete the last round's block if it's still there $oldBlock = Block::newFromTarget( 'UserOnForeignWiki' ); @@ -343,6 +359,8 @@ class BlockTest extends MediaWikiLangTestCase { /** * @dataProvider providerXff + * @covers Block::getBlocksForIPList + * @covers Block::chooseBlock */ public function testBlocksOnXff( $xff, $exCount, $exResult ) { $list = array_map( 'trim', explode( ',', $xff ) ); diff --git a/tests/phpunit/includes/CdbTest.php b/tests/phpunit/includes/CdbTest.php index e3d9da7c84..4832ada657 100644 --- a/tests/phpunit/includes/CdbTest.php +++ b/tests/phpunit/includes/CdbTest.php @@ -2,6 +2,8 @@ /** * Test the CDB reader/writer + * @covers CdbWriter_PHP + * @covers CdbWriter_DBA */ class CdbTest extends MediaWikiTestCase { diff --git a/tests/phpunit/includes/CollationTest.php b/tests/phpunit/includes/CollationTest.php index 43bb3941fc..c6a7169cab 100644 --- a/tests/phpunit/includes/CollationTest.php +++ b/tests/phpunit/includes/CollationTest.php @@ -1,4 +1,12 @@ assertStringStartsWith( $baseBin, $extendedBin, "$base is not a prefix of $extended" ); } - function prefixDataProvider() { + public static function prefixDataProvider() { return array( array( 'en', 'A', 'AA' ), array( 'en', 'A', 'AAA' ), @@ -63,7 +71,7 @@ class CollationTest extends MediaWikiLangTestCase { $this->assertStringStartsNotWith( $baseBin, $extendedBin, "$base is a prefix of $extended" ); } - function notPrefixDataProvider() { + public static function notPrefixDataProvider() { return array( array( 'en', 'A', 'B' ), array( 'en', 'AC', 'ABC' ), diff --git a/tests/phpunit/includes/DiffHistoryBlobTest.php b/tests/phpunit/includes/DiffHistoryBlobTest.php index a4d5b91a95..76a9a10c8f 100644 --- a/tests/phpunit/includes/DiffHistoryBlobTest.php +++ b/tests/phpunit/includes/DiffHistoryBlobTest.php @@ -23,6 +23,7 @@ class DiffHistoryBlobTest extends MediaWikiTestCase { /** * Test for DiffHistoryBlob::xdiffAdler32() * @dataProvider provideXdiffAdler32 + * @covers DiffHistoryBlob::xdiffAdler32 */ public function testXdiffAdler32( $input ) { $xdiffHash = substr( xdiff_string_rabdiff( $input, '' ), 0, 4 ); diff --git a/tests/phpunit/includes/EditPageTest.php b/tests/phpunit/includes/EditPageTest.php index 87272a4c93..7d2b04fbfd 100644 --- a/tests/phpunit/includes/EditPageTest.php +++ b/tests/phpunit/includes/EditPageTest.php @@ -13,6 +13,7 @@ class EditPageTest extends MediaWikiLangTestCase { /** * @dataProvider provideExtractSectionTitle + * @covers EditPage::extractSectionTitle */ public function testExtractSectionTitle( $section, $title ) { $extracted = EditPage::extractSectionTitle( $section ); @@ -59,7 +60,7 @@ class EditPageTest extends MediaWikiLangTestCase { * wrapper around assertEquals() which calls rrtrim() to normalize the * expected and actual texts. */ - function assertEditedTextEquals( $expected, $actual, $msg = '' ) { + protected function assertEditedTextEquals( $expected, $actual, $msg = '' ) { return $this->assertEquals( rtrim( $expected ), rtrim( $actual ), $msg ); } @@ -172,6 +173,10 @@ class EditPageTest extends MediaWikiLangTestCase { return $page; } + /** + * @todo split into a dataprovider and test method + * @covers EditPage + */ public function testCreatePage() { $this->assertEdit( 'EditPageTest_testCreatePage', @@ -338,6 +343,7 @@ hello /** * @dataProvider provideSectionEdit + * @covers EditPage */ public function testSectionEdit( $base, $section, $text, $summary, $expected ) { $edit = array( @@ -432,6 +438,7 @@ hello /** * @dataProvider provideAutoMerge + * @covers EditPage */ public function testAutoMerge( $baseUser, $text, $adamsEdit, $bertasEdit, $expectedCode, $expectedText, $message = null diff --git a/tests/phpunit/includes/ExternalStoreTest.php b/tests/phpunit/includes/ExternalStoreTest.php index fcffcbc21a..ba155a48e8 100644 --- a/tests/phpunit/includes/ExternalStoreTest.php +++ b/tests/phpunit/includes/ExternalStoreTest.php @@ -5,6 +5,9 @@ class ExternalStoreTest extends MediaWikiTestCase { + /** + * @covers ExternalStore::fetchFromURL + */ public function testExternalFetchFromURL() { $this->setMwGlobals( 'wgExternalStores', false ); diff --git a/tests/phpunit/includes/ExtraParserTest.php b/tests/phpunit/includes/ExtraParserTest.php index 6c67beb1ed..dc1915441f 100644 --- a/tests/phpunit/includes/ExtraParserTest.php +++ b/tests/phpunit/includes/ExtraParserTest.php @@ -5,6 +5,11 @@ */ class ExtraParserTest extends MediaWikiTestCase { + /** @var ParserOptions */ + protected $options; + /** @var Parser */ + protected $parser; + protected function setUp() { parent::setUp(); @@ -26,7 +31,10 @@ class ExtraParserTest extends MediaWikiTestCase { MagicWord::clearCache(); } - // Bug 8689 - Long numeric lines kill the parser + /** + * Bug 8689 - Long numeric lines kill the parser + * @covers Parser::parse + */ public function testBug8689() { global $wgUser; $longLine = '1.' . str_repeat( '1234567890', 100000 ) . "\n"; @@ -37,13 +45,19 @@ class ExtraParserTest extends MediaWikiTestCase { $this->parser->parse( $longLine, $t, $options )->getText() ); } - /* Test the parser entry points */ + /** + * Test the parser entry points + * @covers Parser::parse + */ public function testParse() { $title = Title::newFromText( __FUNCTION__ ); $parserOutput = $this->parser->parse( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options ); $this->assertEquals( "

Test\nContent of Template:Foo\nContent of Template:Bar\n

", $parserOutput->getText() ); } + /** + * @covers Parser::preSaveTransform + */ public function testPreSaveTransform() { global $wgUser; $title = Title::newFromText( __FUNCTION__ ); @@ -52,6 +66,9 @@ class ExtraParserTest extends MediaWikiTestCase { $this->assertEquals( "Test\nContent of ''Template:Foo''\n{{Bar}}", $outputText ); } + /** + * @covers Parser::preprocess + */ public function testPreprocess() { $title = Title::newFromText( __FUNCTION__ ); $outputText = $this->parser->preprocess( "Test\n{{Foo}}\n{{Bar}}", $title, $this->options ); @@ -61,6 +78,7 @@ class ExtraParserTest extends MediaWikiTestCase { /** * cleanSig() makes all templates substs and removes tildes + * @covers Parser::cleanSig */ public function testCleanSig() { $title = Title::newFromText( __FUNCTION__ ); @@ -71,6 +89,7 @@ class ExtraParserTest extends MediaWikiTestCase { /** * cleanSig() should do nothing if disabled + * @covers Parser::cleanSig */ public function testCleanSigDisabled() { $this->setMwGlobals( 'wgCleanSignatures', false ); @@ -84,6 +103,7 @@ class ExtraParserTest extends MediaWikiTestCase { /** * cleanSigInSig() just removes tildes * @dataProvider provideStringsForCleanSigInSig + * @covers Parser::cleanSigInSig */ public function testCleanSigInSig( $in, $out ) { $this->assertEquals( Parser::cleanSigInSig( $in ), $out ); @@ -97,6 +117,9 @@ class ExtraParserTest extends MediaWikiTestCase { ); } + /** + * @covers Parser::getSection + */ public function testGetSection() { $outputText2 = $this->parser->getSection( "Section 0\n== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2\n== Heading 3 ==\nSection 3\n", 2 ); $outputText1 = $this->parser->getSection( "Section 0\n== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2\n== Heading 3 ==\nSection 3\n", 1 ); @@ -105,6 +128,9 @@ class ExtraParserTest extends MediaWikiTestCase { $this->assertEquals( "== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2", $outputText1 ); } + /** + * @covers Parser::replaceSection + */ public function testReplaceSection() { $outputText = $this->parser->replaceSection( "Section 0\n== Heading 1 ==\nSection 1\n=== Heading 2 ===\nSection 2\n== Heading 3 ==\nSection 3\n", 1, "New section 1" ); @@ -113,6 +139,7 @@ class ExtraParserTest extends MediaWikiTestCase { /** * Templates and comments are not affected, but noinclude/onlyinclude is. + * @covers Parser::getPreloadText */ public function testGetPreloadText() { $title = Title::newFromText( __FUNCTION__ ); @@ -133,6 +160,7 @@ class ExtraParserTest extends MediaWikiTestCase { /** * @group Database + * @covers Parser::parse */ public function testTrackingCategory() { $title = Title::newFromText( __FUNCTION__ ); @@ -146,6 +174,7 @@ class ExtraParserTest extends MediaWikiTestCase { /** * @group Database + * @covers Parser::parse */ public function testTrackingCategorySpecial() { // Special pages shouldn't have tracking cats. diff --git a/tests/phpunit/includes/FauxRequestTest.php b/tests/phpunit/includes/FauxRequestTest.php index 9f3aa11dad..3246410f09 100644 --- a/tests/phpunit/includes/FauxRequestTest.php +++ b/tests/phpunit/includes/FauxRequestTest.php @@ -2,6 +2,10 @@ class FauxRequestTest extends MediaWikiTestCase { + /** + * @covers FauxRequest::setHeader + * @covers FauxRequest::getHeader + */ public function testGetSetHeader() { $value = 'test/test'; diff --git a/tests/phpunit/includes/FauxResponseTest.php b/tests/phpunit/includes/FauxResponseTest.php index f9ba1b3bf9..7f41cfd396 100644 --- a/tests/phpunit/includes/FauxResponseTest.php +++ b/tests/phpunit/includes/FauxResponseTest.php @@ -23,19 +23,28 @@ */ class FauxResponseTest extends MediaWikiTestCase { - var $response; + /** @var FauxResponse */ + protected $response; protected function setUp() { parent::setUp(); $this->response = new FauxResponse; } + /** + * @covers FauxResponse::getcookie + * @covers FauxResponse::setcookie + */ public function testCookie() { $this->assertEquals( null, $this->response->getcookie( 'key' ), 'Non-existing cookie' ); $this->response->setcookie( 'key', 'val' ); $this->assertEquals( 'val', $this->response->getcookie( 'key' ), 'Existing cookie' ); } + /** + * @covers FauxResponse::getheader + * @covers FauxResponse::header + */ public function testHeader() { $this->assertEquals( null, $this->response->getheader( 'Location' ), 'Non-existing header' ); @@ -52,6 +61,9 @@ class FauxResponseTest extends MediaWikiTestCase { $this->assertEquals( 'http://localhost/', $this->response->getheader( 'LOCATION' ), 'Get header case insensitive' ); } + /** + * @covers FauxResponse::getStatusCode + */ public function testResponseCode() { $this->response->header( 'HTTP/1.1 200' ); $this->assertEquals( 200, $this->response->getStatusCode(), 'Header with no message' ); diff --git a/tests/phpunit/includes/FormOptionsInitializationTest.php b/tests/phpunit/includes/FormOptionsInitializationTest.php index fb2304dca1..1531b5695b 100644 --- a/tests/phpunit/includes/FormOptionsInitializationTest.php +++ b/tests/phpunit/includes/FormOptionsInitializationTest.php @@ -35,7 +35,6 @@ class FormOptionsInitializationTest extends MediaWikiTestCase { */ protected $object; - /** * A new fresh and empty FormOptions object to test initialization * with. @@ -45,6 +44,9 @@ class FormOptionsInitializationTest extends MediaWikiTestCase { $this->object = new FormOptionsExposed(); } + /** + * @covers FormOptionsExposed::add + */ public function testAddStringOption() { $this->object->add( 'foo', 'string value' ); $this->assertEquals( @@ -60,6 +62,9 @@ class FormOptionsInitializationTest extends MediaWikiTestCase { ); } + /** + * @covers FormOptionsExposed::add + */ public function testAddIntegers() { $this->object->add( 'one', 1 ); $this->object->add( 'negone', -1 ); diff --git a/tests/phpunit/includes/FormOptionsTest.php b/tests/phpunit/includes/FormOptionsTest.php index 0a13cfec59..08d6ba8956 100644 --- a/tests/phpunit/includes/FormOptionsTest.php +++ b/tests/phpunit/includes/FormOptionsTest.php @@ -60,6 +60,7 @@ class FormOptionsTest extends MediaWikiTestCase { /** * Reuse helpers above assertGuessBoolean assertGuessInt assertGuessString + * @covers FormOptions::guessType */ public function testGuessTypeDetection() { $this->assertGuessBoolean( true ); @@ -78,12 +79,14 @@ class FormOptionsTest extends MediaWikiTestCase { /** * @expectedException MWException + * @covers FormOptions::guessType */ public function testGuessTypeOnArrayThrowException() { $this->object->guessType( array( 'foo' ) ); } /** * @expectedException MWException + * @covers FormOptions::guessType */ public function testGuessTypeOnNullThrowException() { $this->object->guessType( null ); diff --git a/tests/phpunit/includes/HTMLCheckMatrixTest.php b/tests/phpunit/includes/HTMLCheckMatrixTest.php index 5bbafd37c1..39c39595e2 100644 --- a/tests/phpunit/includes/HTMLCheckMatrixTest.php +++ b/tests/phpunit/includes/HTMLCheckMatrixTest.php @@ -1,7 +1,8 @@ 'test', ); + /** + * @covers HTMLCheckMatrix::__construct + */ public function testPlainInstantiation() { try { $form = new HTMLCheckMatrix( array() ); @@ -21,11 +25,17 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase { $this->fail( 'Expected MWException indicating missing parameters but none was thrown.' ); } + /** + * @covers HTMLCheckMatrix::__construct + */ public function testInstantiationWithMinimumRequiredParameters() { $form = new HTMLCheckMatrix( self::$defaultOptions ); $this->assertTrue( true ); // form instantiation must throw exception on failure } + /** + * @covers HTMLFormField::validate + */ public function testValidateCallsUserDefinedValidationCallback() { $called = false; $field = new HTMLCheckMatrix( self::$defaultOptions + array( @@ -38,6 +48,9 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase { $this->assertTrue( $called ); } + /** + * @covers HTMLFormField::validate + */ public function testValidateRequiresArrayInput() { $field = new HTMLCheckMatrix( self::$defaultOptions ); $this->assertEquals( false, $this->validate( $field, null ) ); @@ -47,11 +60,17 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase { $this->assertEquals( true, $this->validate( $field, array() ) ); } + /** + * @covers HTMLFormField::validate + */ public function testValidateAllowsOnlyKnownTags() { $field = new HTMLCheckMatrix( self::$defaultOptions ); $this->assertInternalType( 'string', $this->validate( $field, array( 'foo' ) ) ); } + /** + * @covers HTMLFormField::validate + */ public function testValidateAcceptsPartialTagList() { $field = new HTMLCheckMatrix( self::$defaultOptions ); $this->assertTrue( $this->validate( $field, array() ) ); @@ -65,6 +84,7 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase { * foreach ( $field->filterDataForSubmit( $data ) as $k => $v ) { * $user->setOption( $k, $v ); * } + * @covers HTMLFormField::filterDataForSubmit */ public function testValuesForcedOnRemainOn() { $field = new HTMLCheckMatrix( self::$defaultOptions + array( @@ -79,6 +99,9 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase { $this->assertEquals( $expected, $field->filterDataForSubmit( array() ) ); } + /** + * @covers HTMLFormField::filterDataForSubmit + */ public function testValuesForcedOffRemainOff() { $field = new HTMLCheckMatrix( self::$defaultOptions + array( 'force-options-off' => array( 'c1-r2', 'c2-r2' ), diff --git a/tests/phpunit/includes/HashRingTest.php b/tests/phpunit/includes/HashRingTest.php index 65f1369619..68dfea1f7f 100644 --- a/tests/phpunit/includes/HashRingTest.php +++ b/tests/phpunit/includes/HashRingTest.php @@ -4,6 +4,9 @@ * @group HashRing */ class HashRingTest extends MediaWikiTestCase { + /** + * @covers HashRing + */ public function testHashRing() { $ring = new HashRing( array( 's1' => 1, 's2' => 1, 's3' => 2, 's4' => 2, 's5' => 2, 's6' => 3 ) ); diff --git a/tests/phpunit/includes/HooksTest.php b/tests/phpunit/includes/HooksTest.php index 81dd48704a..87af6c1f3b 100644 --- a/tests/phpunit/includes/HooksTest.php +++ b/tests/phpunit/includes/HooksTest.php @@ -35,6 +35,7 @@ class HooksTest extends MediaWikiTestCase { /** * @dataProvider provideHooks + * @covers ::wfRunHooks */ public function testOldStyleHooks( $msg, array $hook, $expectedFoo, $expectedBar ) { global $wgHooks; @@ -49,6 +50,8 @@ class HooksTest extends MediaWikiTestCase { /** * @dataProvider provideHooks + * @covers Hooks::register + * @covers Hooks::run */ public function testNewStyleHooks( $msg, $hook, $expectedFoo, $expectedBar ) { $foo = $bar = 'original'; @@ -60,6 +63,12 @@ class HooksTest extends MediaWikiTestCase { $this->assertSame( $expectedBar, $bar, $msg ); } + /** + * @covers Hooks::isRegistered + * @covers Hooks::register + * @covers Hooks::getHandlers + * @covers Hooks::run + */ public function testNewStyleHookInteraction() { global $wgHooks; @@ -82,12 +91,16 @@ class HooksTest extends MediaWikiTestCase { /** * @expectedException MWException + * @covers Hooks::run */ public function testUncallableFunction() { Hooks::register( 'MediaWikiHooksTest001', 'ThisFunctionDoesntExist' ); Hooks::run( 'MediaWikiHooksTest001', array() ); } + /** + * @covers Hooks::run + */ public function testFalseReturn() { Hooks::register( 'MediaWikiHooksTest001', function ( &$foo ) { return false; @@ -104,6 +117,7 @@ class HooksTest extends MediaWikiTestCase { /** * @expectedException FatalError + * @covers Hooks::run */ public function testFatalError() { Hooks::register( 'MediaWikiHooksTest001', function () { diff --git a/tests/phpunit/includes/HtmlFormatterTest.php b/tests/phpunit/includes/HtmlFormatterTest.php index a37df74fc1..7ef0b60c23 100644 --- a/tests/phpunit/includes/HtmlFormatterTest.php +++ b/tests/phpunit/includes/HtmlFormatterTest.php @@ -6,6 +6,7 @@ class HtmlFormatterTest extends MediaWikiTestCase { /** * @dataProvider getHtmlData + * @covers HtmlFormatter::getText */ public function testTransform( $input, $expected, $callback = false ) { $input = self::normalize( $input ); diff --git a/tests/phpunit/includes/HtmlTest.php b/tests/phpunit/includes/HtmlTest.php index 1c62d0324a..21372a0816 100644 --- a/tests/phpunit/includes/HtmlTest.php +++ b/tests/phpunit/includes/HtmlTest.php @@ -41,6 +41,9 @@ class HtmlTest extends MediaWikiTestCase { ) ); } + /** + * @covers Html::element + */ public function testElementBasics() { $this->assertEquals( '', @@ -89,11 +92,15 @@ class HtmlTest extends MediaWikiTestCase { /** * @dataProvider dataXmlMimeType + * @covers Html::isXmlMimeType */ public function testXmlMimeType( $mimetype, $isXmlMimeType ) { $this->assertEquals( $isXmlMimeType, Html::isXmlMimeType( $mimetype ) ); } + /** + * @covers HTML::expandAttributes + */ public function testExpandAttributesSkipsNullAndFalse() { ### EMPTY ######## @@ -111,6 +118,9 @@ class HtmlTest extends MediaWikiTestCase { ); } + /** + * @covers HTML::expandAttributes + */ public function testExpandAttributesForBooleans() { $this->assertEquals( '', @@ -146,6 +156,7 @@ class HtmlTest extends MediaWikiTestCase { /** * Test for Html::expandAttributes() * Please note it output a string prefixed with a space! + * @covers Html::expandAttributes */ public function testExpandAttributesVariousExpansions() { ### NOT EMPTY #### @@ -198,6 +209,7 @@ class HtmlTest extends MediaWikiTestCase { * Html::expandAttributes has special features for HTML * attributes that use space separated lists and also * allows arrays to be used as values. + * @covers Html::expandAttributes */ public function testExpandAttributesListValueAttributes() { ### STRING VALUES @@ -249,6 +261,7 @@ class HtmlTest extends MediaWikiTestCase { /** * Test feature added by r96188, let pass attributes values as * a PHP array. Restricted to class,rel, accesskey. + * @covers Html::expandAttributes */ public function testExpandAttributesSpaceSeparatedAttributesWithBoolean() { $this->assertEquals( @@ -273,6 +286,7 @@ class HtmlTest extends MediaWikiTestCase { * The later will take precedence. * * Feature added by r96188 + * @covers Html::expandAttributes */ public function testValueIsAuthoritativeInSpaceSeparatedAttributesArrays() { $this->assertEquals( @@ -285,6 +299,9 @@ class HtmlTest extends MediaWikiTestCase { ); } + /** + * @covers Html::namespaceSelector + */ public function testNamespaceSelector() { $this->assertEquals( '