@covers tags for inclues/*Test
authoraddshore <addshorewiki@gmail.com>
Thu, 24 Oct 2013 10:54:02 +0000 (11:54 +0100)
committeraddshore <addshorewiki@gmail.com>
Thu, 24 Oct 2013 10:54:02 +0000 (11:54 +0100)
Change-Id: Id28acdd8fe0028bf1e46344cfed131076c8f4c95

20 files changed:
tests/phpunit/includes/ArticleTablesTest.php
tests/phpunit/includes/ArticleTest.php
tests/phpunit/includes/BlockTest.php
tests/phpunit/includes/CdbTest.php
tests/phpunit/includes/CollationTest.php
tests/phpunit/includes/DiffHistoryBlobTest.php
tests/phpunit/includes/EditPageTest.php
tests/phpunit/includes/ExternalStoreTest.php
tests/phpunit/includes/ExtraParserTest.php
tests/phpunit/includes/FauxRequestTest.php
tests/phpunit/includes/FauxResponseTest.php
tests/phpunit/includes/FormOptionsInitializationTest.php
tests/phpunit/includes/FormOptionsTest.php
tests/phpunit/includes/HTMLCheckMatrixTest.php
tests/phpunit/includes/HashRingTest.php
tests/phpunit/includes/HooksTest.php
tests/phpunit/includes/HtmlFormatterTest.php
tests/phpunit/includes/HtmlTest.php
tests/phpunit/includes/LanguageConverterTest.php
tests/phpunit/includes/WikiPageTest.php

index 0f159ae..c749598 100644 (file)
@@ -5,6 +5,10 @@
  */
 class ArticleTablesTest extends MediaWikiLangTestCase {
 
+       /**
+        * @covers Title::getTemplateLinksFrom
+        * @covers Title::getLinksFrom
+        */
        public function testbug14404() {
                global $wgContLang, $wgLanguageCode, $wgLang;
 
index b4d6dca..84f900f 100644 (file)
@@ -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 ) );
-       }
 }
index 21de098..f0049fe 100644 (file)
@@ -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 ) );
index e3d9da7..4832ada 100644 (file)
@@ -2,6 +2,8 @@
 
 /**
  * Test the CDB reader/writer
+ * @covers CdbWriter_PHP
+ * @covers CdbWriter_DBA
  */
 class CdbTest extends MediaWikiTestCase {
 
index 43bb394..c6a7169 100644 (file)
@@ -1,4 +1,12 @@
 <?php
+
+/**
+ * Class CollationTest
+ * @covers Collation
+ * @covers IcuCollation
+ * @covers IdentityCollation
+ * @covers UppercaseCollation
+ */
 class CollationTest extends MediaWikiLangTestCase {
        protected function setUp() {
                parent::setUp();
@@ -30,7 +38,7 @@ class CollationTest extends MediaWikiLangTestCase {
                $this->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' ),
index a4d5b91..76a9a10 100644 (file)
@@ -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 );
index 87272a4..7d2b04f 100644 (file)
@@ -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
index fcffcbc..ba155a4 100644 (file)
@@ -5,6 +5,9 @@
 
 class ExternalStoreTest extends MediaWikiTestCase {
 
+       /**
+        * @covers ExternalStore::fetchFromURL
+        */
        public function testExternalFetchFromURL() {
                $this->setMwGlobals( 'wgExternalStores', false );
 
index 6c67beb..dc19154 100644 (file)
@@ -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( "<p>Test\nContent of <i>Template:Foo</i>\nContent of <i>Template:Bar</i>\n</p>", $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.
index 9f3aa11..3246410 100644 (file)
@@ -2,6 +2,10 @@
 
 class FauxRequestTest extends MediaWikiTestCase {
 
+       /**
+        * @covers FauxRequest::setHeader
+        * @covers FauxRequest::getHeader
+        */
        public function testGetSetHeader() {
                $value = 'test/test';
 
index f9ba1b3..7f41cfd 100644 (file)
  */
 
 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' );
index fb2304d..1531b56 100644 (file)
@@ -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 );
index 0a13cfe..08d6ba8 100644 (file)
@@ -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 );
index 5bbafd3..39c3959 100644 (file)
@@ -1,7 +1,8 @@
 <?php
 
 /**
- * Unit tests for the HTMLCheckMatrix form field
+ * Unit tests for the HTMLCheckMatrix + HTMLFormField
+ * @todo the tests for the two classes could be split up
  */
 class HtmlCheckMatrixTest extends MediaWikiTestCase {
        static private $defaultOptions = array(
@@ -10,6 +11,9 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase {
                'fieldname' => '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' ),
index 65f1369..68dfea1 100644 (file)
@@ -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 ) );
 
index 81dd487..87af6c1 100644 (file)
@@ -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 () {
index a37df74..7ef0b60 100644 (file)
@@ -6,6 +6,7 @@
 class HtmlFormatterTest extends MediaWikiTestCase {
        /**
         * @dataProvider getHtmlData
+        * @covers HtmlFormatter::getText
         */
        public function testTransform( $input, $expected, $callback = false ) {
                $input = self::normalize( $input );
index 1c62d03..21372a0 100644 (file)
@@ -41,6 +41,9 @@ class HtmlTest extends MediaWikiTestCase {
                ) );
        }
 
+       /**
+        * @covers Html::element
+        */
        public function testElementBasics() {
                $this->assertEquals(
                        '<img>',
@@ -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(
                        '<select id=namespace name=namespace>' . "\n" .
@@ -415,6 +432,7 @@ class HtmlTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideHtml5InputTypes
+        * @covers Html::element
         */
        public function testHtmlElementAcceptsNewHtml5TypesInHtml5Mode( $HTML5InputType ) {
                $this->assertEquals(
@@ -617,6 +635,9 @@ class HtmlTest extends MediaWikiTestCase {
                return $ret;
        }
 
+       /**
+        * @covers Html::expandAttributes
+        */
        public function testFormValidationBlacklist() {
                $this->assertEmpty(
                        Html::expandAttributes( array( 'min' => 1, 'max' => 100, 'pattern' => 'abc', 'required' => true, 'step' => 2 ) ),
index 7c2134b..d4ccca9 100644 (file)
@@ -1,7 +1,9 @@
 <?php
 
 class LanguageConverterTest extends MediaWikiLangTestCase {
+       /** @var LanguageToTest */
        protected $lang = null;
+       /** @var TestConverter */
        protected $lc = null;
 
        protected function setUp() {
@@ -30,10 +32,17 @@ class LanguageConverterTest extends MediaWikiLangTestCase {
                parent::tearDown();
        }
 
+       /**
+        * @covers LanguageConverter::getPreferredVariant
+        */
        public function testGetPreferredVariantDefaults() {
                $this->assertEquals( 'tg', $this->lc->getPreferredVariant() );
        }
 
+       /**
+        * @covers LanguageConverter::getPreferredVariant
+        * @covers LanguageConverter::getHeaderVariant
+        */
        public function testGetPreferredVariantHeaders() {
                global $wgRequest;
                $wgRequest->setHeader( 'Accept-Language', 'tg-latn' );
@@ -41,6 +50,10 @@ class LanguageConverterTest extends MediaWikiLangTestCase {
                $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
        }
 
+       /**
+        * @covers LanguageConverter::getPreferredVariant
+        * @covers LanguageConverter::getHeaderVariant
+        */
        public function testGetPreferredVariantHeaderWeight() {
                global $wgRequest;
                $wgRequest->setHeader( 'Accept-Language', 'tg;q=1' );
@@ -48,6 +61,10 @@ class LanguageConverterTest extends MediaWikiLangTestCase {
                $this->assertEquals( 'tg', $this->lc->getPreferredVariant() );
        }
 
+       /**
+        * @covers LanguageConverter::getPreferredVariant
+        * @covers LanguageConverter::getHeaderVariant
+        */
        public function testGetPreferredVariantHeaderWeight2() {
                global $wgRequest;
                $wgRequest->setHeader( 'Accept-Language', 'tg-latn;q=1' );
@@ -55,6 +72,10 @@ class LanguageConverterTest extends MediaWikiLangTestCase {
                $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
        }
 
+       /**
+        * @covers LanguageConverter::getPreferredVariant
+        * @covers LanguageConverter::getHeaderVariant
+        */
        public function testGetPreferredVariantHeaderMulti() {
                global $wgRequest;
                $wgRequest->setHeader( 'Accept-Language', 'en, tg-latn;q=1' );
@@ -62,6 +83,9 @@ class LanguageConverterTest extends MediaWikiLangTestCase {
                $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
        }
 
+       /**
+        * @covers LanguageConverter::getPreferredVariant
+        */
        public function testGetPreferredVariantUserOption() {
                global $wgUser;
 
@@ -75,6 +99,10 @@ class LanguageConverterTest extends MediaWikiLangTestCase {
                $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
        }
 
+       /**
+        * @covers LanguageConverter::getPreferredVariant
+        * @covers LanguageConverter::getUserVariant
+        */
        public function testGetPreferredVariantUserOptionForForeignLanguage() {
                global $wgContLang, $wgUser;
 
@@ -89,6 +117,11 @@ class LanguageConverterTest extends MediaWikiLangTestCase {
                $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
        }
 
+       /**
+        * @covers LanguageConverter::getPreferredVariant
+        * @covers LanguageConverter::getUserVariant
+        * @covers LanguageConverter::getURLVariant
+        */
        public function testGetPreferredVariantHeaderUserVsUrl() {
                global $wgContLang, $wgRequest, $wgUser;
 
@@ -103,7 +136,9 @@ class LanguageConverterTest extends MediaWikiLangTestCase {
                $this->assertEquals( 'tg', $this->lc->getPreferredVariant() );
        }
 
-
+       /**
+        * @covers LanguageConverter::getPreferredVariant
+        */
        public function testGetPreferredVariantDefaultLanguageVariant() {
                global $wgDefaultLanguageVariant;
 
@@ -111,6 +146,10 @@ class LanguageConverterTest extends MediaWikiLangTestCase {
                $this->assertEquals( 'tg-latn', $this->lc->getPreferredVariant() );
        }
 
+       /**
+        * @covers LanguageConverter::getPreferredVariant
+        * @covers LanguageConverter::getURLVariant
+        */
        public function testGetPreferredVariantDefaultLanguageVsUrlVariant() {
                global $wgDefaultLanguageVariant, $wgRequest, $wgContLang;
 
index e0d786b..1258eb1 100644 (file)
@@ -1071,4 +1071,21 @@ more stuff
 
                $this->assertEquals( $expected, $text );
        }
+
+       /**
+        * @covers WikiPage::factory
+        */
+       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 ) );
+       }
 }