Page MenuHomePhabricator

testMediaWikiTestCaseParentSetupCalled does not have @covers annotations
Closed, ResolvedPublic

Description

In the class MediaWikiTestCase, there is one test automatically added, testMediaWikiTestCaseParentSetupCalled, checking that the setUp function calls its parent. This test does not have @covers or @uses annotations.

When I tested my extension MediaWikiFarm with test classes inhereting from MediaWikiTestCase, this test is marked as "risky" by PHPUnit 4.8 when the strict code coverage is activated (--coverage-html docs/coverage --strict-coverage). I modified the MediaWiki file tests/phpunit/suite.xml to whitelist my extension code, and removed MediaWiki internals (directories includes, etc.) to speedup the code coverage, so perhaps it does not like it, but I just checked with the very standard version of MediaWiki without extension and the test is still reported as "risky" because a zillion of functions are called (in setUp, etc.) but not marked as @covers or @uses.

To avoid marking this test risky because of absence of @covers, there would be the possibility of adding zillions of @covers but this would be a bad choice because any extension extending MediaWikiTestCase would still trigger the non-@covers warning. Instead, the test could be annotated by @coversNothing. I tested and the test now pass without warning. This would mark as "pass" instead of "risky" as much tests there are test classes, currently 478 in core.

Reference to @coversNothing in PHPUnit documentation

Event Timeline

Seb35 created this task.Dec 11 2016, 7:57 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 11 2016, 7:57 PM
Seb35 triaged this task as Lowest priority.Dec 11 2016, 7:57 PM
Seb35 moved this task from Unsorted to Test coverage on the Technical-Debt board.
Seb35 updated the task description. (Show Details)Dec 11 2016, 8:04 PM

Change 326363 had a related patch set uploaded (by Seb35):
The automatic test in MediaWikiTestCase was marked as risky

https://gerrit.wikimedia.org/r/326363

Changed the tag to a specialised tag

Change 326363 merged by jenkins-bot:
The automatic test in MediaWikiTestCase was marked as risky

https://gerrit.wikimedia.org/r/326363

Seb35 closed this task as Resolved.Dec 14 2016, 4:33 PM

Reviewed and merged by Legoktm.