From 75d0941e7dccc344c5e916f43e37b583bb2767b3 Mon Sep 17 00:00:00 2001 From: Aryeh Gregor Date: Thu, 9 Aug 2018 17:17:46 +0300 Subject: [PATCH] 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 --- tests/phpunit/MediaWikiTestCase.php | 2 +- tests/phpunit/includes/RevisionDbTestBase.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 ); -- 2.20.1