TL:DR; I would like a system that would let extensions provide different settings when run in a test context.
The mediawiki-extensions-hhvm job (which is triggered by multiple repositories) has been broken because the SpamBlacklist extension points by default to meta.wikimedia.org which was unreachable (T89052). From extensions/SpamBlackList.php:
$wgBlacklistSettings = array( 'spam' => array( 'files' => array( "https://meta.wikimedia.org/w/index.php?title=Spam_blacklist&action=raw&sb_ver=1" ) ) );
In a test context, the SpamBlacklist would want to set $wgBlacklistSettings = array();.
Another example is ConfirmEdit which enables captcha by default, but that has side effects on tests from other extensions ( T44145 ). @Florian proposed https://gerrit.wikimedia.org/r/#/c/182480/ which turns $wgCaptchaTriggers false. His patch reuses a hack we introduced for the Wikibase extension: Jenkins injects a specific global variable when preparing the environment to test, that let extensions developers reacts differently:
# Injected by Jenkins: $wgWikimediaJenkinsCI = true; # Extension if ( isset( $wgWikimediaJenkinsCI ) && $wgWikimediaJenkinsCI ) { // some hacks and conf changes }
I don't really like this hack, it is asking for more cruft and tech debt to pill up soonish.
We could get either:
- a new hook UnitTestsSettings in tests/phpunit/MediaWikiTestCase.php, to let extensions tweak their settings.
- a well supported variable $wgTestsSettings , we would use keys as global name to override entries in $_GLOBAL.
Thoughts ideas?