Page MenuHomePhabricator

Reduce duplication for UnitTestList hook in extensions
Closed, ResolvedPublic

Description

Most extensions use the same implementation of the UnitTestList hook (eg: https://github.com/wikimedia/mediawiki-extensions-Thanks/blob/master/Thanks.hooks.php#L245).

Some just use a plain glob() which is nice until someone adds a subdirectory in tests/ and tests look like they're passing but they're actually not even being run.

My idea is that we just turn that into a closure passed with the hook, so the subscriber simply becomes:

public static function registerUnitTests( array &$files, Closure $recursiveFinder ) {
$files += $recursiveFinder( DIR . '/tests' );
return true;
}

Or something.


Version: 1.24rc
Severity: normal

Details

Reference
bz70630

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:47 AM
bzimport set Reference to bz70630.
Legoktm created this task.Sep 9 2014, 9:35 PM

Yes! Here's a patch that should help:
https://gerrit.wikimedia.org/r/163528

gerritadmin wrote:

Change 163528 had a related patch set uploaded by Hashar:
Extensions may add tests by directory

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

gerritadmin wrote:

Change 163528 merged by jenkins-bot:
Extensions may add tests by directory

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

gerritadmin wrote:

Change 168207 had a related patch set uploaded by Awight:
Extensions may add tests by directory

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

gerritadmin wrote:

Change 168207 merged by jenkins-bot:
Extensions may add tests by directory

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

Was backported, so setting milestone 1.24