jenkins-bot has submitted this change and it was merged.

Change subject: Reset the LocalClusterObjectCache service in tests
......................................................................


Reset the LocalClusterObjectCache service in tests

Change-Id: If5df8ebfb33b762d46cb1e7ed8b6a0360281ce04
---
M repo/tests/phpunit/includes/EditEntityTest.php
1 file changed, 16 insertions(+), 8 deletions(-)

Approvals:
  Hoo man: Looks good to me, but someone else must approve
  Aude: Looks good to me, approved
  Legoktm: Looks good to me, approved
  Daniel Kinzler: Looks good to me, but someone else must approve
  Addshore: Looks good to me, approved
  Thiemo Mättig (WMDE): Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/repo/tests/phpunit/includes/EditEntityTest.php 
b/repo/tests/phpunit/includes/EditEntityTest.php
index 1f3f1f9..429f567 100644
--- a/repo/tests/phpunit/includes/EditEntityTest.php
+++ b/repo/tests/phpunit/includes/EditEntityTest.php
@@ -650,13 +650,17 @@
                );
 
                // make sure we have a working cache
-               $this->setMwGlobals(
-                       'wgMainCacheType',
-                       CACHE_ANYTHING
-               );
-
-               // make sure we have a fresh cache
-               ObjectCache::clear();
+               $services = \MediaWiki\MediaWikiServices::getInstance();
+               if ( method_exists( $services, 'getLocalClusterObjectCache' ) ) 
{
+                       $services->resetServiceForTesting( 
'LocalClusterObjectCache' );
+                       $services->redefineService( 'LocalClusterObjectCache', 
function () {
+                               return new \HashBagOStuff();
+                       } );
+               } else {
+                       $this->setMwGlobals( 'wgMainCacheType', CACHE_ANYTHING 
);
+                       // make sure we have a fresh cache
+                       ObjectCache::clear();
+               }
 
                $user = $this->getUser( 'UserForTestAttemptSaveRateLimit' );
                $this->setUserGroups( $user, $groups );
@@ -688,7 +692,11 @@
                }
 
                // make sure nobody else has to work with our cache
-               ObjectCache::clear();
+               if ( method_exists( $services, 'getLocalClusterObjectCache' ) ) 
{
+                       $services->resetServiceForTesting( 
'LocalClusterObjectCache' );
+               } else {
+                       ObjectCache::clear();
+               }
        }
 
        public function provideIsTokenOk() {

-- 
To view, visit https://gerrit.wikimedia.org/r/308444
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If5df8ebfb33b762d46cb1e7ed8b6a0360281ce04
Gerrit-PatchSet: 10
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Maven-release-user <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to