The UnitTestsListHook was added in MediaWiki in rMWcf4654399bd3: Extensions may add tests by directory (1.24), so extensions had to use some boilerplate code to implement this hook so that tests could be registered with MediaWiki. Then a few years later, rMW1d7221d066c0: Autodiscover extension unittests was added, which uses ExtensionRegistry to automatically discovering the unit tests paths.
So, it seems like UnitTestsListHook is no longer needed.
The existing implementers of the hook (thanks to @Jdforrester-WMF for listing these) are:
- Parsoid https://gerrit.wikimedia.org/g/mediawiki/services/parsoid/+/debcd18399a4f598f47a856d614c973e99cb1738/extension/src/UnitTestsListHandler.php
- Wikibase https://gerrit.wikimedia.org/g/mediawiki/extensions/Wikibase/+/aa639057e36c48ff1c3dcc0694c870d1ee4cda3b/extension-client.json and https://gerrit.wikimedia.org/g/mediawiki/extensions/Wikibase/+/aa639057e36c48ff1c3dcc0694c870d1ee4cda3b/extension-repo.json
- DonationInterface https://gerrit.wikimedia.org/g/mediawiki/extensions/DonationInterface/+/27bd326f012c688d09c58460062841976a998649/extension.json#427
Longer term, it seems that it would be nice to not use ExtensionRegistry so that we don't need to bootstrap MediaWiki to find tests that should be run (just use phpunit.xml.dist rules for discovering files), but that could be done later, as part of a different task.