From: Aryeh Gregor Date: Thu, 9 Aug 2018 14:17:46 +0000 (+0300) Subject: Tests can't call resetGlobalServices() X-Git-Tag: 1.34.0-rc.0~4480^2~1 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=75d0941e7dccc344c5e916f43e37b583bb2767b3;p=lhc%2Fweb%2Fwiklou.git Tests can't call resetGlobalServices() They are supposed to call overrideMwServices() instead, per documentation. One test does call resetGlobalServices(), probably by mistake. It can be private so other tests won't make the same mistake. Change-Id: I11ed598fcc901d0d9951724f2d210d3a7a1482d2 --- diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 366806ead9..a8cc25242a 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -275,7 +275,7 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { * MediaWikiServices. * @return MediaWikiServices */ - protected static function resetGlobalServices( Config $bootstrapConfig = null ) { + private static function resetGlobalServices( Config $bootstrapConfig = null ) { $oldServices = MediaWikiServices::getInstance(); $oldConfigFactory = $oldServices->getConfigFactory(); $oldLoadBalancerFactory = $oldServices->getDBLoadBalancerFactory(); diff --git a/tests/phpunit/includes/RevisionDbTestBase.php b/tests/phpunit/includes/RevisionDbTestBase.php index 57b42f6a4a..ff4c198aec 100644 --- a/tests/phpunit/includes/RevisionDbTestBase.php +++ b/tests/phpunit/includes/RevisionDbTestBase.php @@ -1386,7 +1386,7 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase { */ public function testNewKnownCurrent() { // Setup the services - $this->resetGlobalServices(); + $this->overrideMwServices(); $cache = new WANObjectCache( [ 'cache' => new HashBagOStuff() ] ); $this->setService( 'MainWANObjectCache', $cache ); $db = wfGetDB( DB_MASTER );