Currently, if a class extends MediaWikiUnitTestCase, a structure test ensures that the class is located under tests/phpunit/unit. While that's fine for most of the repos, there are some special cases: Wikibase, to mention a big one.
AFAICS, the alternative chosen until now is to extend PHPUnit\Framework\TestCase, and use MediaWikiCoversValidator and PHPUnit4And6Compat. This is bad, though: first of all because it's unnecessarily longer. Second, because you'd be renouncing to all MediaWikiUnitTestCase features. Third, because it makes it harder to make any change to the used traits; e.g., rename them, or even remove (like we want to do with PHPUnit4And6Compat now).
Hence, I have three ideas:
- Add a new class, MediaWikiUnitTestCaseNoStructure, extending MediaWikiUnitTestCase and overriding the structure test with empty body;
- Add a new class, MediaWikiUnitTestCaseBase identical to the current UnitTestCase minus the structure test; make MediaWikiUnitTestCase extend it and add the structure test;
- Add a method, say protected function shouldTestDirStructure() { return true; }, and override it + return false where necessary.
This should be tackled before making the direct usage of TestCase grow wildly.