Do not reset extension registry in tests

This breaks later tests, e.g.:

https://gerrit.wikimedia.org/r/c/mediawiki/core/+/450433
https://gerrit.wikimedia.org/r/c/mediawiki/core/+/465423

The only reason this didn't cause test failures until now is because the
namespace data was getting (incorrectly) cached in between tests.  As
soon as we start resetting namespaces for each test, namespaces set by
the extension registry get wiped out by these tests.

Change-Id: Icb7a4a2a5d19fb1f2453b4b57a5271196b0e316d
This commit is contained in:
Aryeh Gregor 2018-10-09 17:13:57 +03:00
parent f69013186e
commit 4228dbd2b7

View file

@ -1,6 +1,7 @@
<?php
use Wikimedia\ScopedCallback;
use Wikimedia\TestingAccessWrapper;
/**
* @covers SimpleCaptcha
@ -67,6 +68,18 @@ class CaptchaTest extends MediaWikiTestCase {
}
private function setCaptchaTriggersAttribute( $trigger, $value ) {
// XXX This is really hacky, but is needed to stop extensions from
// being clobbered in subsequent tests. This should be fixed properly
// by making extension registration happen in services instead of
// globals.
$keys =
TestingAccessWrapper::newFromClass( ExtensionProcessor::class )->globalSettings;
$globalsToStash = [];
foreach ( $keys as $key ) {
$globalsToStash["wg$key"] = $GLOBALS["wg$key"];
}
$this->setMwGlobals( $globalsToStash );
$info = [
'globals' => [],
'callbacks' => [],