Given our convention of whitelisted code coverage tracking in PHPUnit, it doesn't make sense for a test to exist without any @covers annotation. This is a common source of issue for MediaWiki core where code coverage is quite low (<20%), but "actual" coverage I believe is at least somewhat higher given how many tests we have that are simply missing the annotation for the few relevant methods and/or classes.
- How to identify whether a class or file is a PHPUnit test case?
- Maybe something about directory structure and file name? (tests/phpunit/**/*Test.php)
- Maybe it's possible to test the class hierarchy? (subclass of PHPUnit TestCase)
- Maybe just check the class name only? (name ends with "Test")
- How to identify whether a method is a PHPUnit test?
- Method name starts with "test".
- How to enforce the rule?
- Method must have a doc block with at least one @covers annotation.
- Or: Method must be in a class that has a doc block with at least one @covers annotation.
- Or: There's a @coversNothing annotation