Page MenuHomePhabricator

Tag functions that always return a specific value (regardless of class, execution, etc) with @codeCoverageIgnore
Open, Needs TriagePublic

Description

Problem statement:
When looking at https://doc.wikimedia.org/cover/mediawiki-core/, it seems that mediawiki has fairly poor code coverage. However, when looking at specific files, its clear that part of the lack of code coverage stems from the fact that specific types of functions are rarely tested. These include

  • Some API classes' ::getExamplesMessages and ::getHelpUrls
  • Some SpecialPage classes` ::getDisplayFormat, ::doesWrites, ::requiresUnblock, ::isIncludable, ::getGroupName, ::isListed, ::isCached
  • Some QueryPage classes' ::isExpensive, ::isSyndicated, ::sortDescending, ::getOrderFields, ::isCacheable,
  • Some ResourceLoader ::getGroup, ::supportsURLLoading, ::enableModuleContentVersion, ::getDependencies

By highlighting these methods as missing tests, it is harder to find where tests are truly needed

Proposal:
Any function that contains only a return statement, and that returns a set value (not a variable, no function calls) may be marked as @codeCoverageIgnore at a method level

Event Timeline

Restricted Application added a project: User-DannyS712. · View Herald TranscriptSun, Sep 22, 5:27 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Note that ApiStructureTest does test the mentioned methods (and more: T184216#3878417).

Krinkle moved this task from Inbox to PHPUnit on the MediaWiki-Core-Testing board.Tue, Oct 15, 6:46 PM