@covers tags for unit tests
authoraddshore <addshorewiki@gmail.com>
Thu, 24 Oct 2013 16:45:52 +0000 (17:45 +0100)
committeraddshore <addshorewiki@gmail.com>
Thu, 24 Oct 2013 17:22:57 +0000 (18:22 +0100)
Change-Id: I2b486b38326bf23bd379efba2142034e24c0745f

tests/phpunit/includes/LicensesTest.php
tests/phpunit/includes/LinksUpdateTest.php
tests/phpunit/includes/LocalFileTest.php
tests/phpunit/includes/LocalisationCacheTest.php
tests/phpunit/includes/libs/CSSMinTest.php
tests/phpunit/includes/libs/GenericArrayObjectTest.php
tests/phpunit/includes/libs/IEUrlExtensionTest.php
tests/phpunit/includes/libs/JavaScriptMinifierTest.php
tests/phpunit/includes/logging/LogFormatterTest.php
tests/phpunit/includes/media/ExifTest.php

index 478a2ff..63b2c39 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 
+/**
+ * @covers Licenses
+ */
 class LicensesTest extends MediaWikiTestCase {
 
        public function testLicenses() {
index 5ade250..b37ff2e 100644 (file)
@@ -52,6 +52,9 @@ class LinksUpdateTest extends MediaWikiTestCase {
                return array( $t, $po );
        }
 
+       /**
+        * @covers LinksUpdate::addLink
+        */
        public function testUpdate_pagelinks() {
                list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
 
@@ -86,6 +89,9 @@ class LinksUpdateTest extends MediaWikiTestCase {
                ), $update->getRemovedLinks() );
        }
 
+       /**
+        * @covers LinksUpdate::addExternalLink
+        */
        public function testUpdate_externallinks() {
                list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
 
@@ -96,6 +102,9 @@ class LinksUpdateTest extends MediaWikiTestCase {
                ) );
        }
 
+       /**
+        * @covers LinksUpdate::addCategory
+        */
        public function testUpdate_categorylinks() {
                $this->setMwGlobals( 'wgCategoryCollation', 'uppercase' );
 
@@ -108,6 +117,9 @@ class LinksUpdateTest extends MediaWikiTestCase {
                ) );
        }
 
+       /**
+        * @covers LinksUpdate::addInterwikiLink
+        */
        public function testUpdate_iwlinks() {
                list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
 
@@ -119,6 +131,9 @@ class LinksUpdateTest extends MediaWikiTestCase {
                ) );
        }
 
+       /**
+        * @covers LinksUpdate::addTemplate
+        */
        public function testUpdate_templatelinks() {
                list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
 
@@ -129,6 +144,9 @@ class LinksUpdateTest extends MediaWikiTestCase {
                ) );
        }
 
+       /**
+        * @covers LinksUpdate::addImage
+        */
        public function testUpdate_imagelinks() {
                list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
 
@@ -139,6 +157,9 @@ class LinksUpdateTest extends MediaWikiTestCase {
                ) );
        }
 
+       /**
+        * @covers LinksUpdate::addLanguageLink
+        */
        public function testUpdate_langlinks() {
                list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
 
@@ -149,6 +170,9 @@ class LinksUpdateTest extends MediaWikiTestCase {
                ) );
        }
 
+       /**
+        * @covers LinksUpdate::setProperty
+        */
        public function testUpdate_page_props() {
                list( $t, $po ) = $this->makeTitleAndParserOutput( "Testing", 111 );
 
index 2501c78..694f4ae 100644 (file)
@@ -3,6 +3,7 @@
 /**
  * These tests should work regardless of $wgCapitalLinks
  * @group Database
+ * @todo Split tests into providers and test methods
  */
 
 class LocalFileTest extends MediaWikiTestCase {
@@ -35,24 +36,36 @@ class LocalFileTest extends MediaWikiTestCase {
                $this->file_lc = $this->repo_lc->newFile( 'test!' );
        }
 
+       /**
+        * @covers File::getHashPath
+        */
        public function testGetHashPath() {
                $this->assertEquals( '', $this->file_hl0->getHashPath() );
                $this->assertEquals( 'a/a2/', $this->file_hl2->getHashPath() );
                $this->assertEquals( 'c/c4/', $this->file_lc->getHashPath() );
        }
 
+       /**
+        * @covers File::getRel
+        */
        public function testGetRel() {
                $this->assertEquals( 'Test!', $this->file_hl0->getRel() );
                $this->assertEquals( 'a/a2/Test!', $this->file_hl2->getRel() );
                $this->assertEquals( 'c/c4/test!', $this->file_lc->getRel() );
        }
 
+       /**
+        * @covers File::getUrlRel
+        */
        public function testGetUrlRel() {
                $this->assertEquals( 'Test%21', $this->file_hl0->getUrlRel() );
                $this->assertEquals( 'a/a2/Test%21', $this->file_hl2->getUrlRel() );
                $this->assertEquals( 'c/c4/test%21', $this->file_lc->getUrlRel() );
        }
 
+       /**
+        * @covers File::getArchivePath
+        */
        public function testGetArchivePath() {
                $this->assertEquals( 'mwstore://local-backend/test-public/archive', $this->file_hl0->getArchivePath() );
                $this->assertEquals( 'mwstore://local-backend/test-public/archive/a/a2', $this->file_hl2->getArchivePath() );
@@ -60,6 +73,9 @@ class LocalFileTest extends MediaWikiTestCase {
                $this->assertEquals( 'mwstore://local-backend/test-public/archive/a/a2/!', $this->file_hl2->getArchivePath( '!' ) );
        }
 
+       /**
+        * @covers File::getThumbPath
+        */
        public function testGetThumbPath() {
                $this->assertEquals( 'mwstore://local-backend/test-thumb/Test!', $this->file_hl0->getThumbPath() );
                $this->assertEquals( 'mwstore://local-backend/test-thumb/a/a2/Test!', $this->file_hl2->getThumbPath() );
@@ -67,6 +83,9 @@ class LocalFileTest extends MediaWikiTestCase {
                $this->assertEquals( 'mwstore://local-backend/test-thumb/a/a2/Test!/x', $this->file_hl2->getThumbPath( 'x' ) );
        }
 
+       /**
+        * @covers File::getArchiveUrl
+        */
        public function testGetArchiveUrl() {
                $this->assertEquals( '/testurl/archive', $this->file_hl0->getArchiveUrl() );
                $this->assertEquals( '/testurl/archive/a/a2', $this->file_hl2->getArchiveUrl() );
@@ -74,6 +93,9 @@ class LocalFileTest extends MediaWikiTestCase {
                $this->assertEquals( '/testurl/archive/a/a2/%21', $this->file_hl2->getArchiveUrl( '!' ) );
        }
 
+       /**
+        * @covers File::getThumbUrl
+        */
        public function testGetThumbUrl() {
                $this->assertEquals( '/testurl/thumb/Test%21', $this->file_hl0->getThumbUrl() );
                $this->assertEquals( '/testurl/thumb/a/a2/Test%21', $this->file_hl2->getThumbUrl() );
@@ -81,6 +103,9 @@ class LocalFileTest extends MediaWikiTestCase {
                $this->assertEquals( '/testurl/thumb/a/a2/Test%21/x', $this->file_hl2->getThumbUrl( 'x' ) );
        }
 
+       /**
+        * @covers File::getArchiveVirtualUrl
+        */
        public function testGetArchiveVirtualUrl() {
                $this->assertEquals( 'mwrepo://test/public/archive', $this->file_hl0->getArchiveVirtualUrl() );
                $this->assertEquals( 'mwrepo://test/public/archive/a/a2', $this->file_hl2->getArchiveVirtualUrl() );
@@ -88,6 +113,9 @@ class LocalFileTest extends MediaWikiTestCase {
                $this->assertEquals( 'mwrepo://test/public/archive/a/a2/%21', $this->file_hl2->getArchiveVirtualUrl( '!' ) );
        }
 
+       /**
+        * @covers File::getThumbVirtualUrl
+        */
        public function testGetThumbVirtualUrl() {
                $this->assertEquals( 'mwrepo://test/thumb/Test%21', $this->file_hl0->getThumbVirtualUrl() );
                $this->assertEquals( 'mwrepo://test/thumb/a/a2/Test%21', $this->file_hl2->getThumbVirtualUrl() );
@@ -95,11 +123,17 @@ class LocalFileTest extends MediaWikiTestCase {
                $this->assertEquals( 'mwrepo://test/thumb/a/a2/Test%21/%21', $this->file_hl2->getThumbVirtualUrl( '!' ) );
        }
 
+       /**
+        * @covers File::getUrl
+        */
        public function testGetUrl() {
                $this->assertEquals( '/testurl/Test%21', $this->file_hl0->getUrl() );
                $this->assertEquals( '/testurl/a/a2/Test%21', $this->file_hl2->getUrl() );
        }
 
+       /**
+        * @covers ::wfLocalFile
+        */
        public function testWfLocalFile() {
                $file = wfLocalFile( "File:Some_file_that_probably_doesn't exist.png" );
                $this->assertThat( $file, $this->isInstanceOf( 'LocalFile' ), 'wfLocalFile() returns LocalFile for valid Titles' );
index b34847a..f98410a 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 
+/**
+ * @covers LocalisationCache
+ */
 class LocalisationCacheTest extends MediaWikiTestCase {
        public function testPuralRulesFallback() {
                $cache = Language::getLocalisationCache();
index 951dd7b..43df5eb 100644 (file)
@@ -20,6 +20,7 @@ class CSSMinTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideMinifyCases
+        * @covers CSSMin::minify
         */
        public function testMinify( $code, $expectedOutput ) {
                $minified = CSSMin::minify( $code );
@@ -69,6 +70,7 @@ class CSSMinTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideRemapCases
+        * @covers CSSMin::remap
         */
        public function testRemap( $message, $params, $expectedOutput ) {
                $remapped = call_user_func_array( 'CSSMin::remap', $params );
@@ -114,6 +116,7 @@ class CSSMinTest extends MediaWikiTestCase {
         *
         * @group Broken
         * @dataProvider provideStringCases
+        * @covers CSSMin::remap
         */
        public function testMinifyWithCSSStringValues( $code, $expectedOutput ) {
                $this->testMinifyOutput( $code, $expectedOutput );
index 7436c43..e2ec474 100644 (file)
@@ -83,6 +83,8 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
         * @since 1.20
         *
         * @param array $elements
+        *
+        * @covers GenericArrayObject::__construct
         */
        public function testConstructor( array $elements ) {
                $arrayObject = $this->getNew( $elements );
@@ -96,6 +98,8 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
         * @since 1.20
         *
         * @param array $elements
+        *
+        * @covers GenericArrayObject::isEmpty
         */
        public function testIsEmpty( array $elements ) {
                $arrayObject = $this->getNew( $elements );
@@ -109,6 +113,8 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
         * @since 1.20
         *
         * @param GenericArrayObject $list
+        *
+        * @covers GenericArrayObject::offsetUnset
         */
        public function testUnset( GenericArrayObject $list ) {
                if ( $list->isEmpty() ) {
@@ -134,6 +140,8 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
         * @since 1.20
         *
         * @param array $elements
+        *
+        * @covers GenericArrayObject::append
         */
        public function testAppend( array $elements ) {
                $list = $this->getNew();
@@ -163,6 +171,8 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
         * @since 1.20
         *
         * @param callback $function
+        *
+        * @covers GenericArrayObject::getObjectType
         */
        protected function checkTypeChecks( $function ) {
                $excption = null;
@@ -194,6 +204,8 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
         * @since 1.20
         *
         * @param array $elements
+        *
+        * @covers GenericArrayObject::offsetSet
         */
        public function testOffsetSet( array $elements ) {
                if ( $elements === array() ) {
@@ -247,6 +259,10 @@ abstract class GenericArrayObjectTest extends MediaWikiTestCase {
         * @since 1.21
         *
         * @param GenericArrayObject $list
+        *
+        * @covers GenericArrayObject::getSerializationData
+        * @covers GenericArrayObject::serialize
+        * @covers GenericArrayObject::unserialize
         */
        public function testSerialization( GenericArrayObject $list ) {
                $serialization = serialize( $list );
index 66fe915..b707123 100644 (file)
@@ -2,8 +2,13 @@
 
 /**
  * Tests for IEUrlExtension::findIE6Extension
+ * @todo tests below for findIE6Extension should be split into...
+ *    ...a dataprovider and test method.
  */
 class IEUrlExtensionTest extends MediaWikiTestCase {
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testSimple() {
                $this->assertEquals(
                        'y',
@@ -12,6 +17,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testSimpleNoExt() {
                $this->assertEquals(
                        '',
@@ -20,6 +28,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testEmpty() {
                $this->assertEquals(
                        '',
@@ -28,6 +39,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testQuestionMark() {
                $this->assertEquals(
                        '',
@@ -36,6 +50,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testExtQuestionMark() {
                $this->assertEquals(
                        'x',
@@ -44,6 +61,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testQuestionMarkExt() {
                $this->assertEquals(
                        'x',
@@ -52,6 +72,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testInvalidChar() {
                $this->assertEquals(
                        '',
@@ -60,6 +83,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testInvalidCharThenExtension() {
                $this->assertEquals(
                        'x',
@@ -68,6 +94,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testMultipleQuestionMarks() {
                $this->assertEquals(
                        'c',
@@ -76,6 +105,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testExeException() {
                $this->assertEquals(
                        'd',
@@ -84,6 +116,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testExeException2() {
                $this->assertEquals(
                        'exe',
@@ -92,6 +127,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testHash() {
                $this->assertEquals(
                        '',
@@ -100,6 +138,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testHash2() {
                $this->assertEquals(
                        '',
@@ -108,6 +149,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testDotAtEnd() {
                $this->assertEquals(
                        '',
@@ -116,6 +160,9 @@ class IEUrlExtensionTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers IEUrlExtension::findIE6Extension
+        */
        public function testTwoDots() {
                $this->assertEquals(
                        'z',
index ab72e36..62ee45a 100644 (file)
@@ -118,6 +118,7 @@ class JavaScriptMinifierTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideCases
+        * @covers JavaScriptMinifier::minify
         */
        public function testJavaScriptMinifierOutput( $code, $expectedOutput ) {
                $minified = JavaScriptMinifier::minify( $code );
@@ -152,6 +153,7 @@ class JavaScriptMinifierTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideBug32548
+        * @covers JavaScriptMinifier::minify
         */
        public function testBug32548Exponent( $num ) {
                // Long line breaking was being incorrectly done between the base and
index e8ccf43..9650fb1 100755 (executable)
@@ -61,6 +61,9 @@ class LogFormatterTest extends MediaWikiLangTestCase {
                return $logEntry;
        }
 
+       /**
+        * @covers LogFormatter::newFromEntry
+        */
        public function testNormalLogParams() {
                $entry = $this->newLogEntry( 'test', array() );
                $formatter = LogFormatter::newFromEntry( $entry );
@@ -99,6 +102,10 @@ class LogFormatterTest extends MediaWikiLangTestCase {
                $this->assertEquals( $titleLink, $paramsWithoutTools[2]['raw'] );
        }
 
+       /**
+        * @covers LogFormatter::newFromEntry
+        * @covers LogFormatter::getActionText
+        */
        public function testLogParamsTypeRaw() {
                $params = array( '4:raw:raw' => Linker::link( $this->title, null, array(), array() ) );
                $expected = Linker::link( $this->title, null, array(), array() );
@@ -112,6 +119,10 @@ class LogFormatterTest extends MediaWikiLangTestCase {
                $this->assertEquals( $expected, $logParam );
        }
 
+       /**
+        * @covers LogFormatter::newFromEntry
+        * @covers LogFormatter::getActionText
+        */
        public function testLogParamsTypeMsg() {
                $params = array( '4:msg:msg' => 'log-description-phpunit' );
                $expected = wfMessage( 'log-description-phpunit' )->text();
@@ -125,6 +136,10 @@ class LogFormatterTest extends MediaWikiLangTestCase {
                $this->assertEquals( $expected, $logParam );
        }
 
+       /**
+        * @covers LogFormatter::newFromEntry
+        * @covers LogFormatter::getActionText
+        */
        public function testLogParamsTypeMsgContent() {
                $params = array( '4:msg-content:msgContent' => 'log-description-phpunit' );
                $expected = wfMessage( 'log-description-phpunit' )->inContentLanguage()->text();
@@ -138,6 +153,10 @@ class LogFormatterTest extends MediaWikiLangTestCase {
                $this->assertEquals( $expected, $logParam );
        }
 
+       /**
+        * @covers LogFormatter::newFromEntry
+        * @covers LogFormatter::getActionText
+        */
        public function testLogParamsTypeNumber() {
                global $wgLang;
 
@@ -153,6 +172,10 @@ class LogFormatterTest extends MediaWikiLangTestCase {
                $this->assertEquals( $expected, $logParam );
        }
 
+       /**
+        * @covers LogFormatter::newFromEntry
+        * @covers LogFormatter::getActionText
+        */
        public function testLogParamsTypeUserLink() {
                $params = array( '4:user-link:userLink' => $this->user->getName() );
                $expected = Linker::userLink(
@@ -169,6 +192,10 @@ class LogFormatterTest extends MediaWikiLangTestCase {
                $this->assertEquals( $expected, $logParam );
        }
 
+       /**
+        * @covers LogFormatter::newFromEntry
+        * @covers LogFormatter::getActionText
+        */
        public function testLogParamsTypeTitleLink() {
                $params = array( '4:title-link:titleLink' => $this->title->getText() );
                $expected = Linker::link( $this->title, null, array(), array() );
@@ -182,6 +209,10 @@ class LogFormatterTest extends MediaWikiLangTestCase {
                $this->assertEquals( $expected, $logParam );
        }
 
+       /**
+        * @covers LogFormatter::newFromEntry
+        * @covers LogFormatter::getActionText
+        */
        public function testLogParamsTypePlain() {
                $params = array( '4:plain:plain' => 'Some plain text' );
                $expected = 'Some plain text';
@@ -195,6 +226,10 @@ class LogFormatterTest extends MediaWikiLangTestCase {
                $this->assertEquals( $expected, $logParam );
        }
 
+       /**
+        * @covers LogFormatter::newFromEntry
+        * @covers LogFormatter::getComment
+        */
        public function testLogComment() {
                $entry = $this->newLogEntry( 'test', array() );
                $formatter = LogFormatter::newFromEntry( $entry );
index dea36b0..4cd2e8e 100644 (file)
@@ -1,4 +1,8 @@
 <?php
+
+/**
+ * @covers Exif
+ */
 class ExifTest extends MediaWikiTestCase {
 
        /** @var string */