Tests can't call resetGlobalServices()
authorAryeh Gregor <ayg@aryeh.name>
Thu, 9 Aug 2018 14:17:46 +0000 (17:17 +0300)
committerAryeh Gregor <ayg@aryeh.name>
Thu, 9 Aug 2018 14:53:14 +0000 (17:53 +0300)
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
tests/phpunit/includes/RevisionDbTestBase.php

index 366806e..a8cc252 100644 (file)
@@ -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();
index 57b42f6..ff4c198 100644 (file)
@@ -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 );