Exempt structure tests from @covers checks
authorGergő Tisza <tgr.huwiki@gmail.com>
Sat, 2 Mar 2019 03:06:54 +0000 (19:06 -0800)
committerLegoktm <legoktm@member.fsf.org>
Tue, 11 Jun 2019 21:40:14 +0000 (21:40 +0000)
@covers does not make any sense for structure tests, which either
do not cover any PHP lines (they test things like configuration or
messages), or cover lines which cannot be determined at the time
of writing the tests (e.g. they cover all classes implementing a
certain interface). Requiring @coversNothing to be manually added
for all of them is a waste of developer time.

tests/phpunit/suite.xml has forceCoversAnnotation=true so removing
the annotations will not change test coverage, these files will
still be skipped.

Change-Id: I27cb58e92341b9b1a76f109701f5bc843adbaa9b

12 files changed:
.phpcs.xml
tests/phpunit/structure/ApiPrefixUniquenessTest.php
tests/phpunit/structure/ApiStructureTest.php
tests/phpunit/structure/AutoLoaderStructureTest.php
tests/phpunit/structure/AvailableRightsTest.php
tests/phpunit/structure/ContentHandlerSanityTest.php
tests/phpunit/structure/DatabaseIntegrationTest.php
tests/phpunit/structure/ExtensionJsonValidationTest.php
tests/phpunit/structure/PasswordPolicyStructureTest.php
tests/phpunit/structure/ResourcesTest.php
tests/phpunit/structure/SpecialPageFatalTest.php
tests/phpunit/structure/StructureTest.php

index 22b74b5..9ccf565 100644 (file)
                -->
                <exclude-pattern>*/maintenance/mwdocgen\.php</exclude-pattern>
        </rule>
+       <rule ref="MediaWiki.Commenting.MissingCovers.MissingCovers">
+               <exclude-pattern>tests/phpunit/structure/*</exclude-pattern>
+       </rule>
        <file>.</file>
        <arg name="encoding" value="UTF-8"/>
        <arg name="extensions" value="php,php5,inc,sample"/>
index 4f95fbb..4329867 100644 (file)
@@ -4,7 +4,6 @@
  * Checks that all API query modules, core and extensions, have unique prefixes.
  *
  * @group API
- * @coversNothing
  */
 class ApiPrefixUniquenessTest extends MediaWikiTestCase {
 
index 0d10a20..6b64b40 100644 (file)
@@ -11,7 +11,6 @@ use Wikimedia\TestingAccessWrapper;
  * - do not have inconsistencies in the parameter definitions
  *
  * @group API
- * @coversNothing
  */
 class ApiStructureTest extends MediaWikiTestCase {
 
index 4e1b00a..37babce 100644 (file)
@@ -1,8 +1,5 @@
 <?php
 
-/**
- * @coversNothing
- */
 class AutoLoaderStructureTest extends MediaWikiTestCase {
        /**
         * Assert that there were no classes loaded that are not registered with the AutoLoader.
index 57b063d..2a6575a 100644 (file)
@@ -35,9 +35,6 @@ class AvailableRightsTest extends PHPUnit\Framework\TestCase {
                return $rights;
        }
 
-       /**
-        * @coversNothing
-        */
        public function testAvailableRights() {
                $missingRights = array_diff(
                        $this->getAllVisibleRights(),
@@ -69,8 +66,6 @@ class AvailableRightsTest extends PHPUnit\Framework\TestCase {
         * Test, if for all rights a right- message exist,
         * which is used on Special:ListGroupRights as help text
         * Extensions and core
-        *
-        * @coversNothing
         */
        public function testAllRightsWithMessage() {
                $this->checkMessagesExist( 'right-' );
index c75a9d0..c8bcd60 100644 (file)
@@ -32,7 +32,6 @@ class ContentHandlerSanityTest extends MediaWikiTestCase {
        }
 
        /**
-        * @coversNothing
         * @dataProvider provideHandlers
         * @param ContentHandler $handler
         */
index 9c0a73d..b0c1c8f 100644 (file)
@@ -5,7 +5,6 @@ use Wikimedia\Rdbms\Database;
 
 /**
  * @group Database
- * @coversNothing
  */
 class DatabaseIntegrationTest extends MediaWikiTestCase {
        /**
index dea8f5a..60c97cc 100644 (file)
@@ -19,8 +19,6 @@
 /**
  * Validates all loaded extensions and skins using the ExtensionRegistry
  * against the extension.json schema in the docs/ folder.
- *
- * @coversNothing
  */
 class ExtensionJsonValidationTest extends PHPUnit\Framework\TestCase {
 
index 60ce575..d7f865d 100644 (file)
@@ -1,8 +1,5 @@
 <?php
 
-/**
- * @coversNothing
- */
 class PasswordPolicyStructureTest extends MediaWikiTestCase {
 
        public function provideChecks() {
index f41ab3a..4c34208 100644 (file)
@@ -14,7 +14,6 @@ use Wikimedia\TestingAccessWrapper;
  * @copyright © 2012, Niklas Laxström
  * @copyright © 2012, Santhosh Thottingal
  * @copyright © 2012, Timo Tijhof
- * @coversNothing
  */
 class ResourcesTest extends MediaWikiTestCase {
 
index 026b903..3fa31fe 100644 (file)
@@ -11,7 +11,6 @@ use MediaWiki\MediaWikiServices;
  *
  * @since 1.32
  * @author Addshore
- * @coversNothing
  */
 class SpecialPageFatalTest extends MediaWikiTestCase {
        public function provideSpecialPages() {
index 97bed4c..412ee99 100644 (file)
@@ -9,7 +9,6 @@ class StructureTest extends MediaWikiTestCase {
         * Verify all files that appear to be tests have file names ending in
         * Test.  If the file names do not end in Test, they will not be run.
         * @group medium
-        * @coversNothing
         */
        public function testUnitTestFileNamesEndWithTest() {
                // realpath() also normalizes directory separator on windows for prefix compares