Fix FileBackendGroup test for some configurations
authorAryeh Gregor <ayg@aryeh.name>
Thu, 29 Aug 2019 11:10:46 +0000 (14:10 +0300)
committerAryeh Gregor <ayg@aryeh.name>
Thu, 29 Aug 2019 13:32:40 +0000 (16:32 +0300)
The expected value of FileBackendGroup::config()['srvCache'] was being
obtained from MediaWikiServices::getLocalServerObjectCache(), but the
class actually used ObjectCache::getLocalServerInstance( 'hash' ). It
happens these are often the same, so it passed the gate-and-submit jobs,
but it's causing failures on Travis CI.

Follow-up to bd2a4395025, which added the failing test. Thanks to
Krinkle for pointing out the failures on CI.

Change-Id: I17651766f4ee2752dfcae9574d2538269dec4ebe

tests/phpunit/includes/filebackend/FileBackendGroupIntegrationTest.php

index ee3262c..00fa1bb 100644 (file)
@@ -49,7 +49,11 @@ class FileBackendGroupIntegrationTest extends MediaWikiIntegrationTestCase {
                $services = MediaWikiServices::getInstance();
 
                foreach ( $serviceMembers as $key => $name ) {
-                       $this->$key = $services->getService( $name );
+                       if ( $key === 'srvCache' ) {
+                               $this->$key = ObjectCache::getLocalServerInstance( 'hash' );
+                       } else {
+                               $this->$key = $services->getService( $name );
+                       }
                }
 
                return FileBackendGroup::singleton();