Add more @covers tags and test cleanup
authoraddshore <addshorewiki@gmail.com>
Mon, 21 Oct 2013 21:09:13 +0000 (23:09 +0200)
committerHashar <hashar@free.fr>
Tue, 22 Oct 2013 08:59:42 +0000 (08:59 +0000)
Other cleanup includes
 - Adding method scopes
 - Fixing php comments
 - Adding todos

Change-Id: I0a231008e6a59110ffcab6af1bd8c4d3ee13f21d

30 files changed:
tests/phpunit/includes/HttpTest.php
tests/phpunit/includes/IPTest.php
tests/phpunit/includes/PathRouterTest.php
tests/phpunit/includes/PreferencesTest.php
tests/phpunit/includes/RecentChangeTest.php
tests/phpunit/includes/RequestContextTest.php
tests/phpunit/includes/ResourceLoaderTest.php
tests/phpunit/includes/RevisionStorageTest.php
tests/phpunit/includes/RevisionStorageTest_ContentHandlerUseDB.php
tests/phpunit/includes/RevisionTest.php
tests/phpunit/includes/SanitizerTest.php
tests/phpunit/includes/SanitizerValidateEmailTest.php
tests/phpunit/includes/SiteConfigurationTest.php
tests/phpunit/includes/TemplateCategoriesTest.php
tests/phpunit/includes/TestUser.php
tests/phpunit/includes/TimeAdjustTest.php
tests/phpunit/includes/TimestampTest.php
tests/phpunit/includes/TitleMethodsTest.php
tests/phpunit/includes/TitlePermissionTest.php
tests/phpunit/includes/TitleTest.php
tests/phpunit/includes/UIDGeneratorTest.php
tests/phpunit/includes/UserTest.php
tests/phpunit/includes/WebRequestTest.php
tests/phpunit/includes/WikiPageTest.php
tests/phpunit/includes/WikiPageTest_ContentHandlerUseDB.php
tests/phpunit/includes/XmlJsTest.php
tests/phpunit/includes/XmlSelectTest.php
tests/phpunit/includes/XmlTest.php
tests/phpunit/includes/XmlTypeCheckTest.php
tests/phpunit/includes/ZipDirectoryReaderTest.php

index d8a0f74..6e0aa88 100644 (file)
@@ -5,8 +5,9 @@
 class HttpTest extends MediaWikiTestCase {
        /**
         * @dataProvider cookieDomains
+        * @covers Cookie::validateCookieDomain
         */
-       function testValidateCookieDomain( $expected, $domain, $origin = null ) {
+       public function testValidateCookieDomain( $expected, $domain, $origin = null ) {
                if ( $origin ) {
                        $ok = Cookie::validateCookieDomain( $domain, $origin );
                        $msg = "$domain against origin $origin";
@@ -50,6 +51,7 @@ class HttpTest extends MediaWikiTestCase {
         * Test Http::isValidURI()
         * @bug 27854 : Http::isValidURI is too lax
         * @dataProvider provideURI
+        * @covers Http::isValidURI
         */
        function testIsValidUri( $expect, $URI, $message = '' ) {
                $this->assertEquals(
@@ -132,7 +134,7 @@ class HttpTest extends MediaWikiTestCase {
         * rewritten when bug 29232 is taken care of (high-level handling of
         * HTTP redirects).
         */
-       function testRelativeRedirections() {
+       public function testRelativeRedirections() {
                $h = MWHttpRequestTester::factory( 'http://oldsite/file.ext' );
 
                # Forge a Location header
index e18295f..22bf0c0 100644 (file)
@@ -1,7 +1,12 @@
 <?php
 /**
- * Tests for IP validity functions. Ported from /t/inc/IP.t by avar.
+ * Tests for IP validity functions.
+ *
+ * Ported from /t/inc/IP.t by avar.
+ *
  * @group IP
+ * @todo Test methods in this call should be split into a method and a
+ * dataprovider.
  */
 
 class IPTest extends MediaWikiTestCase {
index 386ddb8..adfb215 100644 (file)
@@ -1,10 +1,17 @@
 <?php
 /**
- * Tests for the PathRouter parsing
+ * Tests for the PathRouter parsing.
+ *
+ * @todo Add covers tags.
  */
 
 class PathRouterTest extends MediaWikiTestCase {
 
+       /**
+        * @var PathRouter
+        */
+       protected $basicRouter;
+
        protected function setUp() {
                parent::setUp();
                $router = new PathRouter;
index 392ad08..3dec2da 100644 (file)
@@ -4,11 +4,16 @@
  * @group Database
  */
 class PreferencesTest extends MediaWikiTestCase {
-       /** Array of User objects */
+       /**
+        * @var User[]
+        */
        private $prefUsers;
+       /**
+        * @var RequestContext
+        */
        private $context;
 
-       function __construct() {
+       public function __construct() {
                parent::__construct();
 
                $this->prefUsers['noemail'] = new User;
@@ -40,7 +45,7 @@ class PreferencesTest extends MediaWikiTestCase {
         * Placeholder to verify bug 34302
         * @covers Preferences::profilePreferences
         */
-       function testEmailFieldsWhenUserHasNoEmail() {
+       public function testEmailFieldsWhenUserHasNoEmail() {
                $prefs = $this->prefsFor( 'noemail' );
                $this->assertArrayHasKey( 'cssclass',
                        $prefs['emailaddress']
@@ -52,7 +57,7 @@ class PreferencesTest extends MediaWikiTestCase {
         * Placeholder to verify bug 34302
         * @covers Preferences::profilePreferences
         */
-       function testEmailFieldsWhenUserEmailNotAuthenticated() {
+       public function testEmailFieldsWhenUserEmailNotAuthenticated() {
                $prefs = $this->prefsFor( 'notauth' );
                $this->assertArrayHasKey( 'cssclass',
                        $prefs['emailaddress']
@@ -64,7 +69,7 @@ class PreferencesTest extends MediaWikiTestCase {
         * Placeholder to verify bug 34302
         * @covers Preferences::profilePreferences
         */
-       function testEmailFieldsWhenUserEmailIsAuthenticated() {
+       public function testEmailFieldsWhenUserEmailIsAuthenticated() {
                $prefs = $this->prefsFor( 'auth' );
                $this->assertArrayHasKey( 'cssclass',
                        $prefs['emailaddress']
@@ -73,7 +78,7 @@ class PreferencesTest extends MediaWikiTestCase {
        }
 
        /** Helper */
-       function prefsFor( $user_key ) {
+       protected function prefsFor( $user_key ) {
                $preferences = array();
                Preferences::profilePreferences(
                        $this->prefUsers[$user_key]
index f01fb23..cfa3e77 100644 (file)
@@ -9,7 +9,7 @@ class RecentChangeTest extends MediaWikiTestCase {
        protected $user_comment;
        protected $context;
 
-       function __construct() {
+       public function __construct() {
                parent::__construct();
 
                $this->title = Title::newFromText( 'SomeTitle' );
@@ -56,7 +56,7 @@ class RecentChangeTest extends MediaWikiTestCase {
        /**
         * @covers LogFormatter::getIRCActionText
         */
-       function testIrcMsgForLogTypeBlock() {
+       public function testIrcMsgForLogTypeBlock() {
                $sep = $this->context->msg( 'colon-separator' )->text();
 
                # block/block
@@ -78,7 +78,7 @@ class RecentChangeTest extends MediaWikiTestCase {
        /**
         * @covers LogFormatter::getIRCActionText
         */
-       function testIrcMsgForLogTypeDelete() {
+       public function testIrcMsgForLogTypeDelete() {
                $sep = $this->context->msg( 'colon-separator' )->text();
 
                # delete/delete
@@ -101,7 +101,7 @@ class RecentChangeTest extends MediaWikiTestCase {
        /**
         * @covers LogFormatter::getIRCActionText
         */
-       function testIrcMsgForLogTypeNewusers() {
+       public function testIrcMsgForLogTypeNewusers() {
                $this->assertIRCComment(
                        'New user account',
                        'newusers', 'newusers',
@@ -127,7 +127,7 @@ class RecentChangeTest extends MediaWikiTestCase {
        /**
         * @covers LogFormatter::getIRCActionText
         */
-       function testIrcMsgForLogTypeMove() {
+       public function testIrcMsgForLogTypeMove() {
                $move_params = array(
                        '4::target' => $this->target->getPrefixedText(),
                        '5::noredir' => 0,
@@ -154,7 +154,7 @@ class RecentChangeTest extends MediaWikiTestCase {
        /**
         * @covers LogFormatter::getIRCActionText
         */
-       function testIrcMsgForLogTypePatrol() {
+       public function testIrcMsgForLogTypePatrol() {
                # patrol/patrol
                $this->assertIRCComment(
                        $this->context->msg( 'patrol-log-line', 'revision 777', '[[SomeTitle]]', '' )->plain(),
@@ -170,7 +170,7 @@ class RecentChangeTest extends MediaWikiTestCase {
        /**
         * @covers LogFormatter::getIRCActionText
         */
-       function testIrcMsgForLogTypeProtect() {
+       public function testIrcMsgForLogTypeProtect() {
                $protectParams = array(
                        '[edit=sysop] (indefinite) ‎[move=sysop] (indefinite)'
                );
@@ -204,7 +204,7 @@ class RecentChangeTest extends MediaWikiTestCase {
        /**
         * @covers LogFormatter::getIRCActionText
         */
-       function testIrcMsgForLogTypeUpload() {
+       public function testIrcMsgForLogTypeUpload() {
                $sep = $this->context->msg( 'colon-separator' )->text();
 
                # upload/upload
@@ -230,19 +230,19 @@ class RecentChangeTest extends MediaWikiTestCase {
         * --
         */
        /*
-       function testIrcMsgForBlankingAES() {
+       public function testIrcMsgForBlankingAES() {
                // $this->context->msg( 'autosumm-blank', .. );
        }
 
-       function testIrcMsgForReplaceAES() {
+       public function testIrcMsgForReplaceAES() {
                // $this->context->msg( 'autosumm-replace', .. );
        }
 
-       function testIrcMsgForRollbackAES() {
+       public function testIrcMsgForRollbackAES() {
                // $this->context->msg( 'revertpage', .. );
        }
 
-       function testIrcMsgForUndoAES() {
+       public function testIrcMsgForUndoAES() {
                // $this->context->msg( 'undo-summary', .. );
        }
        */
@@ -251,10 +251,11 @@ class RecentChangeTest extends MediaWikiTestCase {
         * @param $expected String Expected IRC text without colors codes
         * @param $type String Log type (move, delete, suppress, patrol ...)
         * @param $action String A log type action
+        * @param $params
         * @param $comment String (optional) A comment for the log action
         * @param $msg String (optional) A message for PHPUnit :-)
         */
-       function assertIRCComment( $expected, $type, $action, $params, $comment = null, $msg = '' ) {
+       protected function assertIRCComment( $expected, $type, $action, $params, $comment = null, $msg = '' ) {
 
                $logEntry = new ManualLogEntry( $type, $action );
                $logEntry->setPerformer( $this->user );
index e3a9cfb..1776b5d 100644 (file)
@@ -7,6 +7,8 @@ class RequestContextTest extends MediaWikiTestCase {
 
        /**
         * Test the relationship between title and wikipage in RequestContext
+        * @covers RequestContext::getWikiPage
+        * @covers RequestContext::getTitle
         */
        public function testWikiPageTitle() {
                $context = new RequestContext();
@@ -27,6 +29,9 @@ class RequestContextTest extends MediaWikiTestCase {
                        "When a title is updated the WikiPage should be purged and recreated on-demand with the new title." );
        }
 
+       /**
+        * @covers RequestContext::importScopedSession
+        */
        public function testImportScopedSession() {
                $context = RequestContext::getMain();
 
index c30c441..ca8b2b6 100644 (file)
@@ -99,6 +99,7 @@ class ResourceLoaderTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider providePackedModules
+        * @covers ResourceLoader::makePackedModulesString
         */
        public function testMakePackedModulesString( $desc, $modules, $packed ) {
                $this->assertEquals( $packed, ResourceLoader::makePackedModulesString( $modules ), $desc );
@@ -106,6 +107,7 @@ class ResourceLoaderTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider providePackedModules
+        * @covers ResourceLoaderContext::expandModuleNames
         */
        public function testexpandModuleNames( $desc, $modules, $packed ) {
                $this->assertEquals( $modules, ResourceLoaderContext::expandModuleNames( $packed ), $desc );
index 00b1f29..e17c7b0 100644 (file)
@@ -38,7 +38,7 @@ class RevisionStorageTest extends MediaWikiTestCase {
                                'iwlinks' ) );
        }
 
-       public function setUp() {
+       protected function setUp() {
                global $wgExtraNamespaces, $wgNamespaceContentModels, $wgContentHandlers, $wgContLang;
 
                parent::setUp();
@@ -456,15 +456,15 @@ class RevisionStorageTest extends MediaWikiTestCase {
         * @dataProvider provideUserWasLastToEdit
         */
        public function testUserWasLastToEdit( $sinceIdx, $expectedLast ) {
-               $userA = \User::newFromName( "RevisionStorageTest_userA" );
-               $userB = \User::newFromName( "RevisionStorageTest_userB" );
+               $userA = User::newFromName( "RevisionStorageTest_userA" );
+               $userB = User::newFromName( "RevisionStorageTest_userB" );
 
                if ( $userA->getId() === 0 ) {
-                       $userA = \User::createNew( $userA->getName() );
+                       $userA = User::createNew( $userA->getName() );
                }
 
                if ( $userB->getId() === 0 ) {
-                       $userB = \User::createNew( $userB->getName() );
+                       $userB = User::createNew( $userB->getName() );
                }
 
                $ns = $this->getDefaultWikitextNS();
index f35a05f..4e83e35 100644 (file)
@@ -7,7 +7,7 @@
  */
 class RevisionTest_ContentHandlerUseDB extends RevisionStorageTest {
 
-       function setUp() {
+       protected function setUp() {
                $this->setMwGlobals( 'wgContentHandlerUseDB', false );
 
                $dbw = wfGetDB( DB_MASTER );
index e3b0844..b5819ff 100644 (file)
@@ -54,7 +54,10 @@ class RevisionTest extends MediaWikiTestCase {
                parent::tearDown();
        }
 
-       function testGetRevisionText() {
+       /**
+        * @covers Revision::getRevisionText
+        */
+       public function testGetRevisionText() {
                $row = new stdClass;
                $row->old_flags = '';
                $row->old_text = 'This is a bunch of revision text.';
@@ -63,7 +66,10 @@ class RevisionTest extends MediaWikiTestCase {
                        Revision::getRevisionText( $row ) );
        }
 
-       function testGetRevisionTextGzip() {
+       /**
+        * @covers Revision::getRevisionText
+        */
+       public function testGetRevisionTextGzip() {
                $this->checkPHPExtension( 'zlib' );
 
                $row = new stdClass;
@@ -74,7 +80,10 @@ class RevisionTest extends MediaWikiTestCase {
                        Revision::getRevisionText( $row ) );
        }
 
-       function testGetRevisionTextUtf8Native() {
+       /**
+        * @covers Revision::getRevisionText
+        */
+       public function testGetRevisionTextUtf8Native() {
                $row = new stdClass;
                $row->old_flags = 'utf-8';
                $row->old_text = "Wiki est l'\xc3\xa9cole superieur !";
@@ -84,7 +93,10 @@ class RevisionTest extends MediaWikiTestCase {
                        Revision::getRevisionText( $row ) );
        }
 
-       function testGetRevisionTextUtf8Legacy() {
+       /**
+        * @covers Revision::getRevisionText
+        */
+       public function testGetRevisionTextUtf8Legacy() {
                $row = new stdClass;
                $row->old_flags = '';
                $row->old_text = "Wiki est l'\xe9cole superieur !";
@@ -94,7 +106,10 @@ class RevisionTest extends MediaWikiTestCase {
                        Revision::getRevisionText( $row ) );
        }
 
-       function testGetRevisionTextUtf8NativeGzip() {
+       /**
+        * @covers Revision::getRevisionText
+        */
+       public function testGetRevisionTextUtf8NativeGzip() {
                $this->checkPHPExtension( 'zlib' );
 
                $row = new stdClass;
@@ -106,7 +121,10 @@ class RevisionTest extends MediaWikiTestCase {
                        Revision::getRevisionText( $row ) );
        }
 
-       function testGetRevisionTextUtf8LegacyGzip() {
+       /**
+        * @covers Revision::getRevisionText
+        */
+       public function testGetRevisionTextUtf8LegacyGzip() {
                $this->checkPHPExtension( 'zlib' );
 
                $row = new stdClass;
@@ -118,7 +136,10 @@ class RevisionTest extends MediaWikiTestCase {
                        Revision::getRevisionText( $row ) );
        }
 
-       function testCompressRevisionTextUtf8() {
+       /**
+        * @covers Revision::compressRevisionText
+        */
+       public function testCompressRevisionTextUtf8() {
                $row = new stdClass;
                $row->old_text = "Wiki est l'\xc3\xa9cole superieur !";
                $row->old_flags = Revision::compressRevisionText( $row->old_text );
@@ -132,7 +153,10 @@ class RevisionTest extends MediaWikiTestCase {
                        Revision::getRevisionText( $row ), "getRevisionText" );
        }
 
-       function testCompressRevisionTextUtf8Gzip() {
+       /**
+        * @covers Revision::compressRevisionText
+        */
+       public function testCompressRevisionTextUtf8Gzip() {
                $this->checkPHPExtension( 'zlib' );
                $this->setMwGlobals( 'wgCompressRevisions', true );
 
@@ -155,6 +179,8 @@ class RevisionTest extends MediaWikiTestCase {
         * @param string $text
         * @param string $title
         * @param string $model
+        * @param null $format
+        *
         * @return Revision
         */
        function newTestRevision( $text, $title = "Test", $model = CONTENT_MODEL_WIKITEXT, $format = null ) {
@@ -194,8 +220,9 @@ class RevisionTest extends MediaWikiTestCase {
        /**
         * @group Database
         * @dataProvider dataGetContentModel
+        * @covers Revision::getContentModel
         */
-       function testGetContentModel( $text, $title, $model, $format, $expectedModel ) {
+       public function testGetContentModel( $text, $title, $model, $format, $expectedModel ) {
                $rev = $this->newTestRevision( $text, $title, $model, $format );
 
                $this->assertEquals( $expectedModel, $rev->getContentModel() );
@@ -214,8 +241,9 @@ class RevisionTest extends MediaWikiTestCase {
        /**
         * @group Database
         * @dataProvider dataGetContentFormat
+        * @covers Revision::getContentFormat
         */
-       function testGetContentFormat( $text, $title, $model, $format, $expectedFormat ) {
+       public function testGetContentFormat( $text, $title, $model, $format, $expectedFormat ) {
                $rev = $this->newTestRevision( $text, $title, $model, $format );
 
                $this->assertEquals( $expectedFormat, $rev->getContentFormat() );
@@ -233,8 +261,9 @@ class RevisionTest extends MediaWikiTestCase {
        /**
         * @group Database
         * @dataProvider dataGetContentHandler
+        * @covers Revision::getContentHandler
         */
-       function testGetContentHandler( $text, $title, $model, $format, $expectedClass ) {
+       public function testGetContentHandler( $text, $title, $model, $format, $expectedClass ) {
                $rev = $this->newTestRevision( $text, $title, $model, $format );
 
                $this->assertEquals( $expectedClass, get_class( $rev->getContentHandler() ) );
@@ -252,8 +281,9 @@ class RevisionTest extends MediaWikiTestCase {
        /**
         * @group Database
         * @dataProvider dataGetContent
+        * @covers Revision::getContent
         */
-       function testGetContent( $text, $title, $model, $format, $audience, $expectedSerialization ) {
+       public function testGetContent( $text, $title, $model, $format, $audience, $expectedSerialization ) {
                $rev = $this->newTestRevision( $text, $title, $model, $format );
                $content = $rev->getContent( $audience );
 
@@ -272,8 +302,9 @@ class RevisionTest extends MediaWikiTestCase {
        /**
         * @group Database
         * @dataProvider dataGetText
+        * @covers Revision::getText
         */
-       function testGetText( $text, $title, $model, $format, $audience, $expectedText ) {
+       public function testGetText( $text, $title, $model, $format, $audience, $expectedText ) {
                $this->hideDeprecated( 'Revision::getText' );
 
                $rev = $this->newTestRevision( $text, $title, $model, $format );
@@ -284,8 +315,9 @@ class RevisionTest extends MediaWikiTestCase {
        /**
         * @group Database
         * @dataProvider dataGetText
+        * @covers Revision::getRawText
         */
-       function testGetRawText( $text, $title, $model, $format, $audience, $expectedText ) {
+       public function testGetRawText( $text, $title, $model, $format, $audience, $expectedText ) {
                $this->hideDeprecated( 'Revision::getRawText' );
 
                $rev = $this->newTestRevision( $text, $title, $model, $format );
@@ -328,6 +360,9 @@ class RevisionTest extends MediaWikiTestCase {
                $this->assertEquals( $expected_hash, $rev->getSha1() );
        }
 
+       /**
+        * @covers Revision::__construct
+        */
        public function testConstructWithText() {
                $this->hideDeprecated( "Revision::getText" );
 
@@ -342,6 +377,9 @@ class RevisionTest extends MediaWikiTestCase {
                $this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $rev->getContentModel() );
        }
 
+       /**
+        * @covers Revision::__construct
+        */
        public function testConstructWithContent() {
                $this->hideDeprecated( "Revision::getText" );
 
@@ -361,8 +399,9 @@ class RevisionTest extends MediaWikiTestCase {
         * Tests whether $rev->getContent() returns a clone when needed.
         *
         * @group Database
+        * @covers Revision::getContent
         */
-       function testGetContentClone() {
+       public function testGetContentClone() {
                $content = new RevisionTestModifyableContent( "foo" );
 
                $rev = new Revision(
@@ -394,8 +433,9 @@ class RevisionTest extends MediaWikiTestCase {
         * Tests whether $rev->getContent() returns the same object repeatedly if appropriate.
         *
         * @group Database
+        * @covers Revision::getContent
         */
-       function testGetContentUncloned() {
+       public function testGetContentUncloned() {
                $rev = $this->newTestRevision( "hello", "testGetContentUncloned_dummy", CONTENT_MODEL_WIKITEXT );
                $content = $rev->getContent( Revision::RAW );
                $content2 = $rev->getContent( Revision::RAW );
index 38c15ee..81246d3 100644 (file)
@@ -1,5 +1,9 @@
 <?php
 
+/**
+ * @todo Tests covering decodeCharReferences can be refactored into a single
+ * method and dataprovider.
+ */
 class SanitizerTest extends MediaWikiTestCase {
 
        protected function setUp() {
@@ -8,7 +12,10 @@ class SanitizerTest extends MediaWikiTestCase {
                AutoLoader::loadClass( 'Sanitizer' );
        }
 
-       function testDecodeNamedEntities() {
+       /**
+        * @covers Sanitizer::decodeCharReferences
+        */
+       public function testDecodeNamedEntities() {
                $this->assertEquals(
                        "\xc3\xa9cole",
                        Sanitizer::decodeCharReferences( '&eacute;cole' ),
@@ -16,7 +23,10 @@ class SanitizerTest extends MediaWikiTestCase {
                );
        }
 
-       function testDecodeNumericEntities() {
+       /**
+        * @covers Sanitizer::decodeCharReferences
+        */
+       public function testDecodeNumericEntities() {
                $this->assertEquals(
                        "\xc4\x88io bonas dans l'\xc3\xa9cole!",
                        Sanitizer::decodeCharReferences( "&#x108;io bonas dans l'&#233;cole!" ),
@@ -24,7 +34,10 @@ class SanitizerTest extends MediaWikiTestCase {
                );
        }
 
-       function testDecodeMixedEntities() {
+       /**
+        * @covers Sanitizer::decodeCharReferences
+        */
+       public function testDecodeMixedEntities() {
                $this->assertEquals(
                        "\xc4\x88io bonas dans l'\xc3\xa9cole!",
                        Sanitizer::decodeCharReferences( "&#x108;io bonas dans l'&eacute;cole!" ),
@@ -32,7 +45,10 @@ class SanitizerTest extends MediaWikiTestCase {
                );
        }
 
-       function testDecodeMixedComplexEntities() {
+       /**
+        * @covers Sanitizer::decodeCharReferences
+        */
+       public function testDecodeMixedComplexEntities() {
                $this->assertEquals(
                        "\xc4\x88io bonas dans l'\xc3\xa9cole! (mais pas &#x108;io dans l'&eacute;cole)",
                        Sanitizer::decodeCharReferences(
@@ -42,7 +58,10 @@ class SanitizerTest extends MediaWikiTestCase {
                );
        }
 
-       function testInvalidAmpersand() {
+       /**
+        * @covers Sanitizer::decodeCharReferences
+        */
+       public function testInvalidAmpersand() {
                $this->assertEquals(
                        'a & b',
                        Sanitizer::decodeCharReferences( 'a & b' ),
@@ -50,7 +69,10 @@ class SanitizerTest extends MediaWikiTestCase {
                );
        }
 
-       function testInvalidEntities() {
+       /**
+        * @covers Sanitizer::decodeCharReferences
+        */
+       public function testInvalidEntities() {
                $this->assertEquals(
                        '&foo;',
                        Sanitizer::decodeCharReferences( '&foo;' ),
@@ -58,7 +80,10 @@ class SanitizerTest extends MediaWikiTestCase {
                );
        }
 
-       function testInvalidNumberedEntities() {
+       /**
+        * @covers Sanitizer::decodeCharReferences
+        */
+       public function testInvalidNumberedEntities() {
                $this->assertEquals( UTF8_REPLACEMENT, Sanitizer::decodeCharReferences( "&#88888888888888;" ), 'Invalid numbered entity' );
        }
 
@@ -69,7 +94,7 @@ class SanitizerTest extends MediaWikiTestCase {
         * @param String $tag Name of an HTML5 element (ie: 'video')
         * @param Boolean $escaped Wheter sanitizer let the tag in or escape it (ie: '&lt;video&gt;')
         */
-       function testRemovehtmltagsOnHtml5Tags( $tag, $escaped ) {
+       public function testRemovehtmltagsOnHtml5Tags( $tag, $escaped ) {
                $this->setMwGlobals( array(
                        'wgUseTidy' => false
                ) );
@@ -131,8 +156,9 @@ class SanitizerTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider dataRemoveHTMLtags
+        * @covers Sanitizer::removeHTMLtags
         */
-       function testRemoveHTMLtags( $input, $output, $msg = null ) {
+       public function testRemoveHTMLtags( $input, $output, $msg = null ) {
                $GLOBALS['wgUseTidy'] = false;
                $this->assertEquals( $output, Sanitizer::removeHTMLtags( $input ), $msg );
        }
@@ -141,7 +167,7 @@ class SanitizerTest extends MediaWikiTestCase {
         * @dataProvider provideTagAttributesToDecode
         * @covers Sanitizer::decodeTagAttributes
         */
-       function testDecodeTagAttributes( $expected, $attributes, $message = '' ) {
+       public function testDecodeTagAttributes( $expected, $attributes, $message = '' ) {
                $this->assertEquals( $expected,
                        Sanitizer::decodeTagAttributes( $attributes ),
                        $message
@@ -189,7 +215,7 @@ class SanitizerTest extends MediaWikiTestCase {
         * @dataProvider provideDeprecatedAttributes
         * @covers Sanitizer::fixTagAttributes
         */
-       function testDeprecatedAttributesUnaltered( $inputAttr, $inputEl, $message = '' ) {
+       public function testDeprecatedAttributesUnaltered( $inputAttr, $inputEl, $message = '' ) {
                $this->assertEquals( " $inputAttr",
                        Sanitizer::fixTagAttributes( $inputAttr, $inputEl ),
                        $message
@@ -217,7 +243,7 @@ class SanitizerTest extends MediaWikiTestCase {
         * @dataProvider provideCssCommentsFixtures
         * @covers Sanitizer::checkCss
         */
-       function testCssCommentsChecking( $expected, $css, $message = '' ) {
+       public function testCssCommentsChecking( $expected, $css, $message = '' ) {
                $this->assertEquals( $expected,
                        Sanitizer::checkCss( $css ),
                        $message
@@ -265,8 +291,9 @@ class SanitizerTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideAttributeSupport
+        * @covers Sanitizer::fixTagAttributes
         */
-       function testAttributeSupport( $tag, $attributes, $expected, $message ) {
+       public function testAttributeSupport( $tag, $attributes, $expected, $message ) {
                $this->assertEquals( $expected,
                        Sanitizer::fixTagAttributes( $attributes, $tag ),
                        $message
index fe0bc64..f13e838 100644 (file)
@@ -1,5 +1,10 @@
 <?php
 
+/**
+ * @covers Sanitizer::validateEmail
+ * @TODO all test methods in this class should be refactored and...
+ *    use a single test method and a single data provider...
+ */
 class SanitizerValidateEmailTest extends MediaWikiTestCase {
 
        private function checkEmail( $addr, $expected = true, $msg = '' ) {
@@ -22,54 +27,56 @@ class SanitizerValidateEmailTest extends MediaWikiTestCase {
                $this->checkEmail( $addr, false, $msg );
        }
 
-       function testEmailWellKnownUserAtHostDotTldAreValid() {
+       public function testEmailWellKnownUserAtHostDotTldAreValid() {
                $this->valid( 'user@example.com' );
                $this->valid( 'user@example.museum' );
        }
 
-       function testEmailWithUpperCaseCharactersAreValid() {
+       public function testEmailWithUpperCaseCharactersAreValid() {
                $this->valid( 'USER@example.com' );
                $this->valid( 'user@EXAMPLE.COM' );
                $this->valid( 'user@Example.com' );
                $this->valid( 'USER@eXAMPLE.com' );
        }
 
-       function testEmailWithAPlusInUserName() {
+       public function testEmailWithAPlusInUserName() {
                $this->valid( 'user+sub@example.com' );
                $this->valid( 'user+@example.com' );
        }
 
-       function testEmailDoesNotNeedATopLevelDomain() {
+       public function testEmailDoesNotNeedATopLevelDomain() {
                $this->valid( "user@localhost" );
                $this->valid( "FooBar@localdomain" );
                $this->valid( "nobody@mycompany" );
        }
 
-       function testEmailWithWhiteSpacesBeforeOrAfterAreInvalids() {
+       public function testEmailWithWhiteSpacesBeforeOrAfterAreInvalids() {
                $this->invalid( " user@host.com" );
                $this->invalid( "user@host.com " );
                $this->invalid( "\tuser@host.com" );
                $this->invalid( "user@host.com\t" );
        }
 
-       function testEmailWithWhiteSpacesAreInvalids() {
+       public function testEmailWithWhiteSpacesAreInvalids() {
                $this->invalid( "User user@host" );
                $this->invalid( "first last@mycompany" );
                $this->invalid( "firstlast@my company" );
        }
 
-       // bug 26948 : comma were matched by an incorrect regexp range
-       function testEmailWithCommasAreInvalids() {
+       /**
+        * bug 26948 : comma were matched by an incorrect regexp range
+        */
+       public function testEmailWithCommasAreInvalids() {
                $this->invalid( "user,foo@example.org" );
                $this->invalid( "userfoo@ex,ample.org" );
        }
 
-       function testEmailWithHyphens() {
+       public function testEmailWithHyphens() {
                $this->valid( "user-foo@example.org" );
                $this->valid( "userfoo@ex-ample.org" );
        }
 
-       function testEmailDomainCanNotBeginWithDot() {
+       public function testEmailDomainCanNotBeginWithDot() {
                $this->invalid( "user@." );
                $this->invalid( "user@.localdomain" );
                $this->invalid( "user@localdomain." );
@@ -78,19 +85,19 @@ class SanitizerValidateEmailTest extends MediaWikiTestCase {
                $this->invalid( ".@a............" );
        }
 
-       function testEmailWithFunnyCharacters() {
+       public function testEmailWithFunnyCharacters() {
                $this->valid( "\$user!ex{this}@123.com" );
        }
 
-       function testEmailTopLevelDomainCanBeNumerical() {
+       public function testEmailTopLevelDomainCanBeNumerical() {
                $this->valid( "user@example.1234" );
        }
 
-       function testEmailWithoutAtSignIsInvalid() {
+       public function testEmailWithoutAtSignIsInvalid() {
                $this->invalid( 'useràexample.com' );
        }
 
-       function testEmailWithOneCharacterDomainIsValid() {
+       public function testEmailWithOneCharacterDomainIsValid() {
                $this->valid( 'user@a' );
        }
 }
index 181a913..053d8a7 100644 (file)
@@ -24,7 +24,11 @@ function getSiteParams( $conf, $wiki ) {
 }
 
 class SiteConfigurationTest extends MediaWikiTestCase {
-       var $mConf;
+
+       /**
+        * @var SiteConfiguration
+        */
+       protected $mConf;
 
        protected function setUp() {
                parent::setUp();
@@ -95,7 +99,10 @@ class SiteConfigurationTest extends MediaWikiTestCase {
                $GLOBALS['global'] = array( 'global' => 'global' );
        }
 
-       function testSiteFromDb() {
+       /**
+        * @covers SiteConfiguration::siteFromDB
+        */
+       public function testSiteFromDb() {
                $this->assertEquals(
                        array( 'wikipedia', 'en' ),
                        $this->mConf->siteFromDB( 'enwiki' ),
@@ -120,7 +127,10 @@ class SiteConfigurationTest extends MediaWikiTestCase {
                );
        }
 
-       function testGetLocalDatabases() {
+       /**
+        * @covers SiteConfiguration::getLocalDatabases
+        */
+       public function testGetLocalDatabases() {
                $this->assertEquals(
                        array( 'enwiki', 'dewiki', 'frwiki' ),
                        $this->mConf->getLocalDatabases(),
@@ -128,7 +138,10 @@ class SiteConfigurationTest extends MediaWikiTestCase {
                );
        }
 
-       function testGetConfVariables() {
+       /**
+        * @covers SiteConfiguration::get
+        */
+       public function testGetConfVariables() {
                $this->assertEquals(
                        'enwiki',
                        $this->mConf->get( 'simple', 'enwiki', 'wiki' ),
@@ -240,7 +253,10 @@ class SiteConfigurationTest extends MediaWikiTestCase {
                );
        }
 
-       function testSiteFromDbWithCallback() {
+       /**
+        * @covers SiteConfiguration::siteFromDB
+        */
+       public function testSiteFromDbWithCallback() {
                $this->mConf->siteParamsCallback = 'getSiteParams';
 
                $this->assertEquals(
@@ -260,7 +276,10 @@ class SiteConfigurationTest extends MediaWikiTestCase {
                );
        }
 
-       function testParameterReplacement() {
+       /**
+        * @covers SiteConfiguration::get
+        */
+       public function testParameterReplacement() {
                $this->mConf->siteParamsCallback = 'getSiteParams';
 
                $this->assertEquals(
@@ -290,7 +309,10 @@ class SiteConfigurationTest extends MediaWikiTestCase {
                );
        }
 
-       function testGetAllGlobals() {
+       /**
+        * @covers SiteConfiguration::getAll
+        */
+       public function testGetAllGlobals() {
                $this->mConf->siteParamsCallback = 'getSiteParams';
 
                $getall = array(
index ffa8c42..906aebd 100644 (file)
@@ -7,20 +7,37 @@ require __DIR__ . "/../../../maintenance/runJobs.php";
 
 class TemplateCategoriesTest extends MediaWikiLangTestCase {
 
+       /**
+        * @covers Title::getParentCategories
+        */
        function testTemplateCategories() {
                $title = Title::newFromText( "Categorized from template" );
                $page = WikiPage::factory( $title );
                $user = new User();
                $user->mRights = array( 'createpage', 'edit', 'purge' );
 
-               $page->doEditContent( new WikitextContent( '{{Categorising template}}' ), 'Create a page with a template', 0, false, $user );
+               $page->doEditContent(
+                       new WikitextContent( '{{Categorising template}}' ),
+                       'Create a page with a template',
+                       0,
+                       false,
+                       $user
+               );
+
                $this->assertEquals(
                        array()
                        , $title->getParentCategories()
                );
 
                $template = WikiPage::factory( Title::newFromText( 'Template:Categorising template' ) );
-               $template->doEditContent( new WikitextContent( '[[Category:Solved bugs]]' ), 'Add a category through a template', 0, false, $user );
+
+               $template->doEditContent(
+                       new WikitextContent( '[[Category:Solved bugs]]' ),
+                       'Add a category through a template',
+                       0,
+                       false,
+                       $user
+               );
 
                // Run the job queue
                JobQueueGroup::destroySingletons();
index 2fb0f49..23e6503 100644 (file)
@@ -1,6 +1,8 @@
 <?php
 
-/* Wraps the user object, so we can also retain full access to properties like password if we log in via the API */
+/**
+ * Wraps the user object, so we can also retain full access to properties like password if we log in via the API
+ */
 class TestUser {
        public $username;
        public $password;
@@ -8,7 +10,7 @@ class TestUser {
        public $groups;
        public $user;
 
-       function __construct( $username, $realname = 'Real Name', $email = 'sample@example.com', $groups = array() ) {
+       public function __construct( $username, $realname = 'Real Name', $email = 'sample@example.com', $groups = array() ) {
                $this->username = $username;
                $this->realname = $realname;
                $this->email = $email;
index 3a2c62a..0b368c2 100644 (file)
@@ -8,8 +8,9 @@ class TimeAdjustTest extends MediaWikiLangTestCase {
        }
 
        /**
-        * Test offset usage for a given language::userAdjust
+        * Test offset usage for a given Language::userAdjust
         * @dataProvider dataUserAdjust
+        * @covers Language::userAdjust
         */
        public function testUserAdjust( $date, $localTZoffset, $expected ) {
                global $wgContLang;
index 3668046..5338839 100644 (file)
@@ -14,8 +14,9 @@ class TimestampTest extends MediaWikiLangTestCase {
        /**
         * Test parsing of valid timestamps and outputing to MW format.
         * @dataProvider provideValidTimestamps
+        * @covers MWTimestamp::getTimestamp
         */
-       function testValidParse( $format, $original, $expected ) {
+       public function testValidParse( $format, $original, $expected ) {
                $timestamp = new MWTimestamp( $original );
                $this->assertEquals( $expected, $timestamp->getTimestamp( TS_MW ) );
        }
@@ -23,8 +24,9 @@ class TimestampTest extends MediaWikiLangTestCase {
        /**
         * Test outputting valid timestamps to different formats.
         * @dataProvider provideValidTimestamps
+        * @covers MWTimestamp::getTimestamp
         */
-       function testValidOutput( $format, $expected, $original ) {
+       public function testValidOutput( $format, $expected, $original ) {
                $timestamp = new MWTimestamp( $original );
                $this->assertEquals( $expected, (string)$timestamp->getTimestamp( $format ) );
        }
@@ -32,16 +34,18 @@ class TimestampTest extends MediaWikiLangTestCase {
        /**
         * Test an invalid timestamp.
         * @expectedException TimestampException
+        * @covers MWTimestamp
         */
-       function testInvalidParse() {
+       public function testInvalidParse() {
                new MWTimestamp( "This is not a timestamp." );
        }
 
        /**
         * Test requesting an invalid output format.
         * @expectedException TimestampException
+        * @covers MWTimestamp::getTimestamp
         */
-       function testInvalidOutput() {
+       public function testInvalidOutput() {
                $timestamp = new MWTimestamp( '1343761268' );
                $timestamp->getTimestamp( 98 );
        }
@@ -69,8 +73,8 @@ class TimestampTest extends MediaWikiLangTestCase {
        }
 
        /**
-        * @test
         * @dataProvider provideHumanTimestampTests
+        * @covers MWTimestamp::getHumanTimestamp
         */
        public function testHumanTimestamp(
                $tsTime, // The timestamp to format
@@ -202,8 +206,8 @@ class TimestampTest extends MediaWikiLangTestCase {
        }
 
        /**
-        * @test
         * @dataProvider provideRelativeTimestampTests
+        * @covers MWTimestamp::getRelativeTimestamp
         */
        public function testRelativeTimestamp(
                $tsTime, // The timestamp to format
index a11c3d9..3079d73 100644 (file)
@@ -6,7 +6,6 @@
  *
  * @note: We don't make assumptions about the main namespace.
  *        But we do expect the Help namespace to contain Wikitext.
- *
  */
 class TitleMethodsTest extends MediaWikiTestCase {
 
@@ -57,6 +56,7 @@ class TitleMethodsTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideEquals
+        * @covers Title::equals
         */
        public function testEquals( $titleA, $titleB, $expectedBool ) {
                $titleA = Title::newFromText( $titleA );
@@ -81,12 +81,16 @@ class TitleMethodsTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideInNamespace
+        * @covers Title::inNamespace
         */
        public function testInNamespace( $title, $ns, $expectedBool ) {
                $title = Title::newFromText( $title );
                $this->assertEquals( $expectedBool, $title->inNamespace( $ns ) );
        }
 
+       /**
+        * @covers Title::inNamespaces
+        */
        public function testInNamespaces() {
                $mainpage = Title::newFromText( 'Main Page' );
                $this->assertTrue( $mainpage->inNamespaces( NS_MAIN, NS_USER ) );
@@ -110,6 +114,7 @@ class TitleMethodsTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideHasSubjectNamespace
+        * @covers Title::hasSubjectNamespace
         */
        public function testHasSubjectNamespace( $title, $ns, $expectedBool ) {
                $title = Title::newFromText( $title );
@@ -143,6 +148,7 @@ class TitleMethodsTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider dataGetContentModel
+        * @covers Title::getContentModel
         */
        public function testGetContentModel( $title, $expectedModelId ) {
                $title = Title::newFromText( $title );
@@ -151,6 +157,7 @@ class TitleMethodsTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider dataGetContentModel
+        * @covers Title::hasContentModel
         */
        public function testHasContentModel( $title, $expectedModelId ) {
                $title = Title::newFromText( $title );
@@ -181,13 +188,13 @@ class TitleMethodsTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideIsCssOrJsPage
+        * @covers Title::isCssOrJsPage
         */
        public function testIsCssOrJsPage( $title, $expectedBool ) {
                $title = Title::newFromText( $title );
                $this->assertEquals( $expectedBool, $title->isCssOrJsPage() );
        }
 
-
        public static function provideIsCssJsSubpage() {
                return array(
                        array( 'Help:Foo', false ),
@@ -210,6 +217,7 @@ class TitleMethodsTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideIsCssJsSubpage
+        * @covers Title::isCssJsSubpage
         */
        public function testIsCssJsSubpage( $title, $expectedBool ) {
                $title = Title::newFromText( $title );
@@ -230,6 +238,7 @@ class TitleMethodsTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideIsCssSubpage
+        * @covers Title::isCssSubpage
         */
        public function testIsCssSubpage( $title, $expectedBool ) {
                $title = Title::newFromText( $title );
@@ -250,6 +259,7 @@ class TitleMethodsTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideIsJsSubpage
+        * @covers Title::isJsSubpage
         */
        public function testIsJsSubpage( $title, $expectedBool ) {
                $title = Title::newFromText( $title );
@@ -281,6 +291,7 @@ class TitleMethodsTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideIsWikitextPage
+        * @covers Title::isWikitextPage
         */
        public function testIsWikitextPage( $title, $expectedBool ) {
                $title = Title::newFromText( $title );
index 9144d0c..f15c177 100644 (file)
@@ -2,6 +2,7 @@
 
 /**
  * @group Database
+ * @todo covers tags
  */
 class TitlePermissionTest extends MediaWikiLangTestCase {
 
@@ -68,7 +69,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                }
        }
 
-       function setUserPerm( $perm ) {
+       protected function setUserPerm( $perm ) {
                // Setting member variables is evil!!!
 
                if ( is_array( $perm ) ) {
@@ -78,11 +79,11 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                }
        }
 
-       function setTitle( $ns, $title = "Main_Page" ) {
+       protected function setTitle( $ns, $title = "Main_Page" ) {
                $this->title = Title::makeTitle( $ns, $title );
        }
 
-       function setUser( $userName = null ) {
+       protected function setUser( $userName = null ) {
                if ( $userName === 'anon' ) {
                        $this->user = $this->anonUser;
                } elseif ( $userName === null || $userName === $this->userName ) {
@@ -92,7 +93,11 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                }
        }
 
-       function testQuickPermissions() {
+       /**
+        * @todo This test method should be split up into separate test methods and
+        * data providers
+        */
+       public function testQuickPermissions() {
                global $wgContLang;
                $prefix = $wgContLang->getFormattedNsText( NS_PROJECT );
 
@@ -320,7 +325,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                }
        }
 
-       function runGroupPermissions( $action, $result, $result2 = null ) {
+       protected function runGroupPermissions( $action, $result, $result2 = null ) {
                global $wgGroupPermissions;
 
                if ( $result2 === null ) {
@@ -348,7 +353,11 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                $this->assertEquals( $result2, $res );
        }
 
-       function testSpecialsAndNSPermissions() {
+       /**
+        * @todo This test method should be split up into separate test methods and
+        * data providers
+        */
+       public function testSpecialsAndNSPermissions() {
                global $wgNamespaceProtection;
                $this->setUser( $this->userName );
 
@@ -399,7 +408,11 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                        $this->title->userCan( 'bogus', $this->user ) );
        }
 
-       function testCssAndJavascriptPermissions() {
+       /**
+        * @todo This test method should be split up into separate test methods and
+        * data providers
+        */
+       public function testCssAndJavascriptPermissions() {
                $this->setUser( $this->userName );
 
                $this->setTitle( NS_USER, $this->userName . '/test.js' );
@@ -448,7 +461,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                );
        }
 
-       function runCSSandJSPermissions( $result0, $result1, $result2, $result3, $result4 ) {
+       protected function runCSSandJSPermissions( $result0, $result1, $result2, $result3, $result4 ) {
                $this->setUserPerm( '' );
                $this->assertEquals( $result0,
                        $this->title->getUserPermissionsErrors( 'bogus',
@@ -485,7 +498,11 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                                $this->user ) );
        }
 
-       function testPageRestrictions() {
+       /**
+        * @todo This test method should be split up into separate test methods and
+        * data providers
+        */
+       public function testPageRestrictions() {
                global $wgContLang;
 
                $prefix = $wgContLang->getFormattedNsText( NS_PROJECT );
@@ -576,7 +593,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                                $this->user ) );
        }
 
-       function testCascadingSourcesRestrictions() {
+       public function testCascadingSourcesRestrictions() {
                $this->setTitle( NS_MAIN, "test page" );
                $this->setUserPerm( array( "edit", "bogus" ) );
 
@@ -596,7 +613,11 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                        $this->title->getUserPermissionsErrors( 'edit', $this->user ) );
        }
 
-       function testActionPermissions() {
+       /**
+        * @todo This test method should be split up into separate test methods and
+        * data providers
+        */
+       public function testActionPermissions() {
                $this->setUserPerm( array( "createpage" ) );
                $this->setTitle( NS_MAIN, "test page" );
                $this->title->mTitleProtection['pt_create_perm'] = '';
@@ -667,7 +688,7 @@ class TitlePermissionTest extends MediaWikiLangTestCase {
                        $this->title->userCan( 'move-target', $this->user ) );
        }
 
-       function testUserBlock() {
+       public function testUserBlock() {
                global $wgEmailConfirmToEdit, $wgEmailAuthentication;
                $wgEmailConfirmToEdit = true;
                $wgEmailAuthentication = true;
index da663c4..6bfe545 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 
 /**
- *
  * @group Database
  *        ^--- needed for language cache stuff
  */
@@ -19,7 +18,10 @@ class TitleTest extends MediaWikiTestCase {
                ) );
        }
 
-       function testLegalChars() {
+       /**
+        * @covers Title::legalChars
+        */
+       public function testLegalChars() {
                $titlechars = Title::legalChars();
 
                foreach ( range( 1, 255 ) as $num ) {
@@ -34,8 +36,10 @@ class TitleTest extends MediaWikiTestCase {
 
        /**
         * See also mediawiki.Title.test.js
+        * @covers Title::secureAndSplit
+        * @todo This method should be split into 2 separate tests each with a provider
         */
-       function testSecureAndSplit() {
+       public function testSecureAndSplit() {
                // Valid
                foreach ( array(
                        'Sandbox',
@@ -171,15 +175,17 @@ class TitleTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideConvertByteClassToUnicodeClass
+        * @covers Title::convertByteClassToUnicodeClass
         */
-       function testConvertByteClassToUnicodeClass( $byteClass, $unicodeClass ) {
+       public function testConvertByteClassToUnicodeClass( $byteClass, $unicodeClass ) {
                $this->assertEquals( $unicodeClass, Title::convertByteClassToUnicodeClass( $byteClass ) );
        }
 
        /**
         * @dataProvider provideBug31100
+        * @covers Title::fixSpecialName
         */
-       function testBug31100FixSpecialName( $text, $expectedParam ) {
+       public function testBug31100FixSpecialName( $text, $expectedParam ) {
                $title = Title::newFromText( $text );
                $fixed = $title->fixSpecialName();
                $stuff = explode( '/', $fixed->getDBkey(), 2 );
@@ -205,10 +211,11 @@ class TitleTest extends MediaWikiTestCase {
         * @group Database
         * @param string $source
         * @param string $target
-        * @param array|string|true $expected Required error
+        * @param array|string|bool $expected Required error
         * @dataProvider provideTestIsValidMoveOperation
+        * @covers Title::isValidMoveOperation
         */
-       function testIsValidMoveOperation( $source, $target, $expected ) {
+       public function testIsValidMoveOperation( $source, $target, $expected ) {
                $title = Title::newFromText( $source );
                $nt = Title::newFromText( $target );
                $errors = $title->isValidMoveOperation( $nt, false );
@@ -225,7 +232,7 @@ class TitleTest extends MediaWikiTestCase {
        /**
         * Provides test parameter values for testIsValidMoveOperation()
         */
-       function dataTestIsValidMoveOperation() {
+       public function dataTestIsValidMoveOperation() {
                return array(
                        array( 'Test', 'Test', 'selfmove' ),
                        array( 'File:Test.jpg', 'Page', 'imagenocrossnamespace' )
@@ -238,12 +245,12 @@ class TitleTest extends MediaWikiTestCase {
         * @param array $whitelistRegexp
         * @param string $source
         * @param string $action
-        * @param array|string|true $expected Required error
+        * @param array|string|bool $expected Required error
         *
         * @covers Title::checkReadPermissions
         * @dataProvider dataWgWhitelistReadRegexp
         */
-       function testWgWhitelistReadRegexp( $whitelistRegexp, $source, $action, $expected ) {
+       public function testWgWhitelistReadRegexp( $whitelistRegexp, $source, $action, $expected ) {
                // $wgWhitelistReadRegexp must be an array. Since the provided test cases
                // usually have only one regex, it is more concise to write the lonely regex
                // as a string. Thus we cast to an array() to honor $wgWhitelistReadRegexp
@@ -300,7 +307,7 @@ class TitleTest extends MediaWikiTestCase {
        /**
         * Provides test parameter values for testWgWhitelistReadRegexp()
         */
-       function dataWgWhitelistReadRegexp() {
+       public function dataWgWhitelistReadRegexp() {
                $ALLOWED = true;
                $DISALLOWED = false;
 
@@ -336,7 +343,7 @@ class TitleTest extends MediaWikiTestCase {
                );
        }
 
-       function flattenErrorsArray( $errors ) {
+       public function flattenErrorsArray( $errors ) {
                $result = array();
                foreach ( $errors as $error ) {
                        $result[] = $error[0];
@@ -353,9 +360,10 @@ class TitleTest extends MediaWikiTestCase {
        }
 
        /**
-        * @dataProvider provideCasesForGetpageviewlanguage
+        * @dataProvider provideGetPageViewLanguage
+        * @covers Title::getPageViewLanguage
         */
-       function testGetpageviewlanguage( $expected, $titleText, $contLang, $lang, $variant, $msg = '' ) {
+       public function testGetPageViewLanguage( $expected, $titleText, $contLang, $lang, $variant, $msg = '' ) {
                global $wgLanguageCode, $wgContLang, $wgLang, $wgDefaultLanguageVariant, $wgAllowUserJs;
 
                // Setup environnement for this test
@@ -375,7 +383,7 @@ class TitleTest extends MediaWikiTestCase {
                );
        }
 
-       public static function provideCasesForGetpageviewlanguage() {
+       public static function provideGetPageViewLanguage() {
                # Format:
                # - expected
                # - Title name
@@ -416,8 +424,9 @@ class TitleTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideBaseTitleCases
+        * @covers Title::getBaseText
         */
-       function testExtractingBaseTextFromTitle( $title, $expected, $msg = '' ) {
+       public function testGetBaseText( $title, $expected, $msg = '' ) {
                $title = Title::newFromText( $title );
                $this->assertEquals( $expected,
                        $title->getBaseText(),
@@ -435,8 +444,9 @@ class TitleTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideRootTitleCases
+        * @covers Title::getRootText
         */
-       function testExtractingRootTextFromTitle( $title, $expected, $msg = '' ) {
+       public function testGetRootText( $title, $expected, $msg = '' ) {
                $title = Title::newFromText( $title );
                $this->assertEquals( $expected,
                        $title->getRootText(),
@@ -455,8 +465,9 @@ class TitleTest extends MediaWikiTestCase {
        /**
         * @todo Handle $wgNamespacesWithSubpages cases
         * @dataProvider provideSubpageTitleCases
+        * @covers Title::getSubpageText
         */
-       function testExtractingSubpageTextFromTitle( $title, $expected, $msg = '' ) {
+       public function testGetSubpageText( $title, $expected, $msg = '' ) {
                $title = Title::newFromText( $title );
                $this->assertEquals( $expected,
                        $title->getSubpageText(),
index 23553ca..8f78ae5 100644 (file)
@@ -1,8 +1,11 @@
 <?php
 
 class UIDGeneratorTest extends MediaWikiTestCase {
+
        /**
         * @dataProvider provider_testTimestampedUID
+        * @covers UIDGenerator::newTimestampedUID128
+        * @covers UIDGenerator::newTimestampedUID88
         */
        public function testTimestampedUID( $method, $digitlen, $bits, $tbits, $hostbits ) {
                $id = call_user_func( array( 'UIDGenerator', $method ) );
@@ -46,6 +49,7 @@ class UIDGeneratorTest extends MediaWikiTestCase {
 
        /**
         * array( method, length, bits, hostbits )
+        * NOTE: When adding a new method name here please update the covers tags for the tests!
         */
        public static function provider_testTimestampedUID() {
                return array(
@@ -55,22 +59,40 @@ class UIDGeneratorTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers UIDGenerator::newUUIDv4
+        */
        public function testUUIDv4() {
                for ( $i = 0; $i < 100; $i++ ) {
                        $id = UIDGenerator::newUUIDv4();
                        $this->assertEquals( true,
                                preg_match( '!^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$!', $id ),
                                "UID $id has the right format" );
+               }
+       }
 
+       /**
+        * @covers UIDGenerator::newRawUUIDv4
+        */
+       public function testRawUUIDv4() {
+               for ( $i = 0; $i < 100; $i++ ) {
                        $id = UIDGenerator::newRawUUIDv4();
                        $this->assertEquals( true,
                                preg_match( '!^[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15}$!', $id ),
                                "UID $id has the right format" );
+               }
+       }
 
+       /**
+        * @covers UIDGenerator::newRawUUIDv4
+        */
+       public function testRawUUIDv4QuickRand() {
+               for ( $i = 0; $i < 100; $i++ ) {
                        $id = UIDGenerator::newRawUUIDv4( UIDGenerator::QUICK_RAND );
                        $this->assertEquals( true,
                                preg_match( '!^[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15}$!', $id ),
                                "UID $id has the right format" );
                }
        }
+
 }
index 0113cab..ff33e82 100644 (file)
@@ -53,6 +53,9 @@ class UserTest extends MediaWikiTestCase {
                );
        }
 
+       /**
+        * @covers User::getGroupPermissions
+        */
        public function testGroupPermissions() {
                $rights = User::getGroupPermissions( array( 'unittesters' ) );
                $this->assertContains( 'runtest', $rights );
@@ -67,6 +70,9 @@ class UserTest extends MediaWikiTestCase {
                $this->assertNotContains( 'nukeworld', $rights );
        }
 
+       /**
+        * @covers User::getGroupPermissions
+        */
        public function testRevokePermissions() {
                $rights = User::getGroupPermissions( array( 'unittesters', 'formertesters' ) );
                $this->assertNotContains( 'runtest', $rights );
@@ -75,6 +81,9 @@ class UserTest extends MediaWikiTestCase {
                $this->assertNotContains( 'nukeworld', $rights );
        }
 
+       /**
+        * @covers User::getRights
+        */
        public function testUserPermissions() {
                $rights = $this->user->getRights();
                $this->assertContains( 'runtest', $rights );
@@ -85,6 +94,7 @@ class UserTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideGetGroupsWithPermission
+        * @covers User::getGroupsWithPermission
         */
        public function testGetGroupsWithPermission( $expected, $right ) {
                $result = User::getGroupsWithPermission( $right );
@@ -117,6 +127,7 @@ class UserTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideUserNames
+        * @covers User::isValidUserName
         */
        public function testIsValidUserName( $username, $result, $message ) {
                $this->assertEquals( $this->user->isValidUserName( $username ), $result, $message );
@@ -171,6 +182,7 @@ class UserTest extends MediaWikiTestCase {
        /**
         * Test User::editCount
         * @group medium
+        * @covers User::getEditCount
         */
        public function testEditCount() {
                $user = User::newFromName( 'UnitTestUser' );
@@ -195,6 +207,8 @@ class UserTest extends MediaWikiTestCase {
 
        /**
         * Test changing user options.
+        * @covers User::setOption
+        * @covers User::getOption
         */
        public function testOptions() {
                $user = User::newFromName( 'UnitTestUser' );
@@ -212,6 +226,7 @@ class UserTest extends MediaWikiTestCase {
        /**
         * Bug 37963
         * Make sure defaults are loaded when setOption is called.
+        * @covers User::loadOptions
         */
        public function testAnonOptions() {
                global $wgDefaultUserOptions;
index 4f5322e..a600188 100644 (file)
@@ -20,6 +20,7 @@ class WebRequestTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideDetectServer
+        * @covers WebRequest::detectServer
         */
        function testDetectServer( $expected, $input, $description ) {
                $_SERVER = $input;
@@ -103,6 +104,7 @@ class WebRequestTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideGetIP
+        * @covers WebRequest::getIP
         */
        function testGetIP( $expected, $input, $squid, $xffList, $private, $description ) {
                $_SERVER = $input;
@@ -272,6 +274,7 @@ class WebRequestTest extends MediaWikiTestCase {
 
        /**
         * @expectedException MWException
+        * @covers WebRequest::getIP
         */
        function testGetIpLackOfRemoteAddrThrowAnException() {
                $request = new WebRequest();
@@ -297,6 +300,7 @@ class WebRequestTest extends MediaWikiTestCase {
 
        /**
         * @dataProvider provideLanguageData
+        * @covers WebRequest::getAcceptLang
         */
        function testAcceptLang( $acceptLanguageHeader, $expectedLanguages, $description ) {
                $_SERVER = array( 'HTTP_ACCEPT_LANGUAGE' => $acceptLanguageHeader );
index bf8cd37..e0d786b 100644 (file)
@@ -1,14 +1,14 @@
 <?php
+
 /**
  * @group ContentHandler
  * @group Database
  * ^--- important, causes temporary tables to be used instead of the real database
  * @group medium
  **/
-
 class WikiPageTest extends MediaWikiLangTestCase {
 
-       var $pages_to_delete;
+       protected $pages_to_delete;
 
        function __construct( $name = null, array $data = array(), $dataName = '' ) {
                parent::__construct( $name, $data, $dataName );
@@ -90,6 +90,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                return $page;
        }
 
+       /**
+        * @covers WikiPage::doEditContent
+        */
        public function testDoEditContent() {
                $page = $this->newPage( "WikiPageTest_testDoEditContent" );
                $title = $page->getTitle();
@@ -143,6 +146,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                $this->assertEquals( 2, $n, 'pagelinks should contain two links from the page' );
        }
 
+       /**
+        * @covers WikiPage::doEdit
+        */
        public function testDoEdit() {
                $this->hideDeprecated( "WikiPage::doEdit" );
                $this->hideDeprecated( "WikiPage::getText" );
@@ -200,6 +206,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                $this->assertEquals( 2, $n, 'pagelinks should contain two links from the page' );
        }
 
+       /**
+        * @covers WikiPage::doQuickEdit
+        */
        public function testDoQuickEdit() {
                global $wgUser;
 
@@ -216,6 +225,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                $this->assertEquals( $text, $page->getText() );
        }
 
+       /**
+        * @covers WikiPage::doQuickEditContent
+        */
        public function testDoQuickEditContent() {
                global $wgUser;
 
@@ -229,6 +241,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                $this->assertTrue( $content->equals( $page->getContent() ) );
        }
 
+       /**
+        * @covers WikiPage::doDeleteArticle
+        */
        public function testDoDeleteArticle() {
                $page = $this->createPage( "WikiPageTest_testDoDeleteArticle", "[[original text]] foo", CONTENT_MODEL_WIKITEXT );
                $id = $page->getId();
@@ -253,6 +268,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                $this->assertEquals( 0, $n, 'pagelinks should contain no more links from the page' );
        }
 
+       /**
+        * @covers WikiPage::doDeleteUpdates
+        */
        public function testDoDeleteUpdates() {
                $page = $this->createPage( "WikiPageTest_testDoDeleteArticle", "[[original text]] foo", CONTENT_MODEL_WIKITEXT );
                $id = $page->getId();
@@ -268,6 +286,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                $this->assertEquals( 0, $n, 'pagelinks should contain no more links from the page' );
        }
 
+       /**
+        * @covers WikiPage::getRevision
+        */
        public function testGetRevision() {
                $page = $this->newPage( "WikiPageTest_testGetRevision" );
 
@@ -283,6 +304,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                $this->assertEquals( "some text", $rev->getContent()->getNativeData() );
        }
 
+       /**
+        * @covers WikiPage::getContent
+        */
        public function testGetContent() {
                $page = $this->newPage( "WikiPageTest_testGetContent" );
 
@@ -296,6 +320,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                $this->assertEquals( "some text", $content->getNativeData() );
        }
 
+       /**
+        * @covers WikiPage::getText
+        */
        public function testGetText() {
                $this->hideDeprecated( "WikiPage::getText" );
 
@@ -311,6 +338,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                $this->assertEquals( "some text", $text );
        }
 
+       /**
+        * @covers WikiPage::getRawText
+        */
        public function testGetRawText() {
                $this->hideDeprecated( "WikiPage::getRawText" );
 
@@ -326,6 +356,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                $this->assertEquals( "some text", $text );
        }
 
+       /**
+        * @covers WikiPage::getContentModel
+        */
        public function testGetContentModel() {
                global $wgContentHandlerUseDB;
 
@@ -339,6 +372,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                $this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $page->getContentModel() );
        }
 
+       /**
+        * @covers WikiPage::getContentHandler
+        */
        public function testGetContentHandler() {
                global $wgContentHandlerUseDB;
 
@@ -352,6 +388,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                $this->assertEquals( 'JavaScriptContentHandler', get_class( $page->getContentHandler() ) );
        }
 
+       /**
+        * @covers WikiPage::exists
+        */
        public function testExists() {
                $page = $this->newPage( "WikiPageTest_testExists" );
                $this->assertFalse( $page->exists() );
@@ -383,6 +422,7 @@ class WikiPageTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider provideHasViewableContent
+        * @covers WikiPage::hasViewableContent
         */
        public function testHasViewableContent( $title, $viewable, $create = false ) {
                $page = $this->newPage( $title );
@@ -406,6 +446,7 @@ class WikiPageTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider provideGetRedirectTarget
+        * @covers WikiPage::getRedirectTarget
         */
        public function testGetRedirectTarget( $title, $model, $text, $target ) {
                $page = $this->createPage( $title, $text, $model );
@@ -421,6 +462,7 @@ class WikiPageTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider provideGetRedirectTarget
+        * @covers WikiPage::isRedirect
         */
        public function testIsRedirect( $title, $model, $text, $target ) {
                $page = $this->createPage( $title, $text, $model );
@@ -537,6 +579,7 @@ class WikiPageTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider provideIsCountable
+        * @covers WikiPage::isCountable
         */
        public function testIsCountable( $title, $model, $text, $mode, $expected ) {
                global $wgContentHandlerUseDB;
@@ -575,6 +618,7 @@ class WikiPageTest extends MediaWikiLangTestCase {
 
        /**
         * @dataProvider provideGetParserOutput
+        * @covers WikiPage::getParserOutput
         */
        public function testGetParserOutput( $model, $text, $expectedHtml ) {
                $page = $this->createPage( 'WikiPageTest_testGetParserOutput', $text, $model );
@@ -591,6 +635,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                return $po;
        }
 
+       /**
+        * @covers WikiPage::getParserOutput
+        */
        public function testGetParserOutput_nonexisting() {
                static $count = 0;
                $count++;
@@ -603,6 +650,9 @@ class WikiPageTest extends MediaWikiLangTestCase {
                $this->assertFalse( $po, "getParserOutput() shall return false for non-existing pages." );
        }
 
+       /**
+        * @covers WikiPage::getParserOutput
+        */
        public function testGetParserOutput_badrev() {
                $page = $this->createPage( 'WikiPageTest_testGetParserOutput', "dummy", CONTENT_MODEL_WIKITEXT );
 
@@ -679,6 +729,7 @@ more stuff
 
        /**
         * @dataProvider dataReplaceSection
+        * @covers WikiPage::replaceSection
         */
        public function testReplaceSection( $title, $model, $text, $section, $with, $sectionTitle, $expected ) {
                $this->hideDeprecated( "WikiPage::replaceSection" );
@@ -692,6 +743,7 @@ more stuff
 
        /**
         * @dataProvider dataReplaceSection
+        * @covers WikiPage::replaceSectionContent
         */
        public function testReplaceSectionContent( $title, $model, $text, $section, $with, $sectionTitle, $expected ) {
                $page = $this->createPage( $title, $text, $model );
@@ -802,6 +854,7 @@ more stuff
 
        /**
         * @todo FIXME: the above rollback test is better, but it keeps failing in jenkins for some reason.
+        * @covers WikiPage::doRollback
         */
        public function testDoRollback() {
                $admin = new User();
@@ -878,6 +931,7 @@ more stuff
 
        /**
         * @dataProvider provideGetAutoSummary
+        * @covers WikiPage::getAutosummary
         */
        public function testGetAutosummary( $old, $new, $flags, $expected ) {
                $this->hideDeprecated( "WikiPage::getAutosummary" );
@@ -950,6 +1004,7 @@ more stuff
 
        /**
         * @dataProvider provideGetAutoDeleteReason
+        * @covers WikiPage::getAutoDeleteReason
         */
        public function testGetAutoDeleteReason( $edits, $expectedResult, $expectedHistory ) {
                global $wgUser;
@@ -1003,6 +1058,7 @@ more stuff
 
        /**
         * @dataProvider providePreSaveTransform
+        * @covers WikiPage::preSaveTransform
         */
        public function testPreSaveTransform( $text, $expected ) {
                $this->hideDeprecated( 'WikiPage::preSaveTransform' );
index 41f3572..2a723e8 100644 (file)
@@ -7,7 +7,7 @@
  */
 class WikiPageTest_ContentHandlerUseDB extends WikiPageTest {
 
-       function setUp() {
+       protected function setUp() {
                parent::setUp();
                $this->setMwGlobals( 'wgContentHandlerUseDB', false );
 
@@ -26,6 +26,9 @@ class WikiPageTest_ContentHandlerUseDB extends WikiPageTest {
                }
        }
 
+       /**
+        * @covers WikiPage::getContentModel
+        */
        public function testGetContentModel() {
                $page = $this->createPage( "WikiPageTest_testGetContentModel", "some text", CONTENT_MODEL_JAVASCRIPT );
 
@@ -36,6 +39,9 @@ class WikiPageTest_ContentHandlerUseDB extends WikiPageTest {
                $this->assertEquals( CONTENT_MODEL_WIKITEXT, $page->getContentModel() );
        }
 
+       /**
+        * @covers WikiPage::getContentHandler
+        */
        public function testGetContentHandler() {
                $page = $this->createPage( "WikiPageTest_testGetContentHandler", "some text", CONTENT_MODEL_JAVASCRIPT );
 
index c5b411f..161468e 100644 (file)
@@ -1,9 +1,24 @@
 <?php
+
+/**
+ * @group Xml
+ */
 class XmlJs extends MediaWikiTestCase {
-       public function testConstruction() {
-               $obj = new XmlJsCode( null );
-               $this->assertNull( $obj->value );
-               $obj = new XmlJsCode( '' );
-               $this->assertSame( $obj->value, '' );
+
+       /**
+        * @covers XmlJsCode::__construct
+        * @dataProvider provideConstruction
+        */
+       public function testConstruction( $value ) {
+               $obj = new XmlJsCode( $value );
+               $this->assertEquals( $value, $obj->value );
        }
+
+       public function provideConstruction(){
+               return array(
+                       array( null ),
+                       array( '' ),
+               );
+       }
+
 }
index 08c031f..56d28b5 100644 (file)
@@ -1,7 +1,13 @@
 <?php
 
-// TODO
+/**
+ * @group Xml
+ */
 class XmlSelectTest extends MediaWikiTestCase {
+
+       /**
+        * @var XmlSelect
+        */
        protected $select;
 
        protected function setUp() {
@@ -17,8 +23,9 @@ class XmlSelectTest extends MediaWikiTestCase {
                $this->select = null;
        }
 
-       ### START OF TESTS ###
-
+       /**
+        * @covers XmlSelect::__construct
+        */
        public function testConstructWithoutParameters() {
                $this->assertEquals( '<select></select>', $this->select->getHTML() );
        }
@@ -26,6 +33,7 @@ class XmlSelectTest extends MediaWikiTestCase {
        /**
         * Parameters are $name (false), $id (false), $default (false)
         * @dataProvider provideConstructionParameters
+        * @covers XmlSelect::__construct
         */
        public function testConstructParameters( $name, $id, $default, $expected ) {
                $this->select = new XmlSelect( $name, $id, $default );
@@ -39,7 +47,6 @@ class XmlSelectTest extends MediaWikiTestCase {
         *  - $id      (default: false)
         *  - $default (default: false)
         * Provides a fourth parameters representing the expected HTML output
-        *
         */
        public static function provideConstructionParameters() {
                return array(
@@ -60,29 +67,41 @@ class XmlSelectTest extends MediaWikiTestCase {
                );
        }
 
-       # Begin XmlSelect::addOption() similar to Xml::option
+       /**
+        * @covers XmlSelect::addOption
+        */
        public function testAddOption() {
                $this->select->addOption( 'foo' );
                $this->assertEquals( '<select><option value="foo">foo</option></select>', $this->select->getHTML() );
        }
 
+       /**
+        * @covers XmlSelect::addOption
+        */
        public function testAddOptionWithDefault() {
                $this->select->addOption( 'foo', true );
                $this->assertEquals( '<select><option value="1">foo</option></select>', $this->select->getHTML() );
        }
 
+       /**
+        * @covers XmlSelect::addOption
+        */
        public function testAddOptionWithFalse() {
                $this->select->addOption( 'foo', false );
                $this->assertEquals( '<select><option value="foo">foo</option></select>', $this->select->getHTML() );
        }
 
+       /**
+        * @covers XmlSelect::addOption
+        */
        public function testAddOptionWithValueZero() {
                $this->select->addOption( 'foo', 0 );
                $this->assertEquals( '<select><option value="0">foo</option></select>', $this->select->getHTML() );
        }
 
-       # End XmlSelect::addOption() similar to Xml::option
-
+       /**
+        * @covers XmlSelect::setDefault
+        */
        public function testSetDefault() {
                $this->select->setDefault( 'bar1' );
                $this->select->addOption( 'foo1' );
@@ -98,6 +117,7 @@ class XmlSelectTest extends MediaWikiTestCase {
         * Adding default later on should set the correct selection or
         * raise an exception.
         * To handle this, we need to render the options in getHtml()
+        * @covers XmlSelect::setDefault
         */
        public function testSetDefaultAfterAddingOptions() {
                $this->select->addOption( 'foo1' );
@@ -110,6 +130,10 @@ class XmlSelectTest extends MediaWikiTestCase {
                                '<option value="foo2">foo2</option></select>', $this->select->getHTML() );
        }
 
+       /**
+        * @covers XmlSelect::setAttribute
+        * @covers XmlSelect::getAttribute
+        */
        public function testGetAttributes() {
                # create some attributes
                $this->select->setAttribute( 'dummy', 0x777 );
index a198832..a0b33ee 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 
+/**
+ * @group Xml
+ */
 class XmlTest extends MediaWikiTestCase {
 
        protected function setUp() {
index 6a9b44f..8d6f1ed 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * PHPUnit tests for XMLTypeCheck.
  * @author physikerwelt
- * @group ?
+ * @group Xml
  * @covers XMLTypeCheck
  */
 class XmlTypeCheckTest extends MediaWikiTestCase {
index 59c7047..7f436cd 100644 (file)
@@ -5,7 +5,8 @@
  * NOTE: this test is more like an integration test than a unit test
  */
 class ZipDirectoryReaderTest extends MediaWikiTestCase {
-       var $zipDir, $entries;
+       protected $zipDir;
+       protected $entries;
 
        protected function setUp() {
                parent::setUp();