Hoo man has submitted this change and it was merged.

Change subject: Clean up MockClientStore
......................................................................


Clean up MockClientStore

I'm not sure why these objects need to be static. I tried to change
this but some tests failed.

Change-Id: I5313b4f774a6a99c8427a2ea4f783d09f0f39eb3
---
M client/tests/phpunit/MockClientStore.php
1 file changed, 102 insertions(+), 22 deletions(-)

Approvals:
  Daniel Kinzler: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/client/tests/phpunit/MockClientStore.php 
b/client/tests/phpunit/MockClientStore.php
index 9b6d402..057e4c1 100644
--- a/client/tests/phpunit/MockClientStore.php
+++ b/client/tests/phpunit/MockClientStore.php
@@ -2,11 +2,19 @@
 
 namespace Wikibase\Test;
 
+use Wikibase\ChangesTable;
+use Wikibase\Client\Store\EntityIdLookup;
 use Wikibase\Client\Usage\NullUsageTracker;
 use Wikibase\Client\Usage\SubscriptionManager;
+use Wikibase\Client\Usage\UsageLookup;
+use Wikibase\Client\Usage\UsageTracker;
 use Wikibase\ClientStore;
+use Wikibase\Lib\Store\EntityLookup;
+use Wikibase\Lib\Store\EntityRevisionLookup;
 use Wikibase\Lib\Store\SiteLinkLookup;
 use Wikibase\PropertyInfoStore;
+use Wikibase\PropertyLabelResolver;
+use Wikibase\TermIndex;
 
 /**
  * (Incomplete) ClientStore mock
@@ -18,45 +26,115 @@
  */
 class MockClientStore implements ClientStore {
 
+       /**
+        * @var MockRepository|null
+        */
+       private static $mockRepository = null;
+
+       /**
+        * @var MockPropertyInfoStore|null
+        */
+       private static $mockPropertyInfoStore = null;
+
+       /**
+        * @see ClientStore::getUsageLookup
+        *
+        * @return UsageLookup
+        */
        public function getUsageLookup() {
                return new NullUsageTracker();
        }
 
+       /**
+        * @see ClientStore::getUsageTracker
+        *
+        * @return UsageTracker
+        */
        public function getUsageTracker() {
                return new NullUsageTracker();
        }
 
+       /**
+        * @see ClientStore::getSubscriptionManager
+        *
+        * @return SubscriptionManager
+        */
        public function getSubscriptionManager() {
                return new SubscriptionManager();
        }
-       public function getPropertyLabelResolver() {}
-       public function getTermIndex() {}
-       public function getEntityIdLookup() {}
-       public function newChangesTable() {}
-       public function clear() {}
-       public function rebuild() {}
 
-       private function getMock() {
-               static $mockRepo = false;
-               if ( !$mockRepo ) {
-                       $mockRepo = new MockRepository();
-               }
-
-               return $mockRepo;
+       /**
+        * @see ClientStore::getPropertyLabelResolver
+        *
+        * @return PropertyLabelResolver
+        */
+       public function getPropertyLabelResolver() {
+               // FIXME: Incomplete
        }
 
-       /*
+       /**
+        * @see ClientStore::getTermIndex
+        *
+        * @return TermIndex
+        */
+       public function getTermIndex() {
+               // FIXME: Incomplete
+       }
+
+       /**
+        * @see ClientStore::getEntityIdLookup
+        *
+        * @return EntityIdLookup
+        */
+       public function getEntityIdLookup() {
+               // FIXME: Incomplete
+       }
+
+       /**
+        * @see ClientStore::newChangesTable
+        *
+        * @return ChangesTable
+        */
+       public function newChangesTable() {
+               // FIXME: Incomplete
+       }
+
+       /**
+        * @see ClientStore::clear
+        */
+       public function clear() {
+       }
+
+       /**
+        * @see ClientStore::rebuild
+        */
+       public function rebuild() {
+       }
+
+       private function getMockRepository() {
+               if ( self::$mockRepository === null ) {
+                       self::$mockRepository = new MockRepository();
+               }
+
+               return self::$mockRepository;
+       }
+
+       /**
+        * @see ClientStore::getEntityLookup
+        *
         * @return EntityLookup
         */
        public function getEntityLookup() {
-               return $this->getMock();
+               return $this->getMockRepository();
        }
 
-       /*
+       /**
+        * @see ClientStore::getEntityRevisionLookup
+        *
         * @return EntityRevisionLookup
         */
        public function getEntityRevisionLookup() {
-               return $this->getMock();
+               return $this->getMockRepository();
        }
 
        /**
@@ -65,18 +143,20 @@
         * @return SiteLinkLookup
         */
        public function getSiteLinkLookup() {
-               return $this->getMock();
+               return $this->getMockRepository();
        }
 
        /**
+        * @see ClientStore::getPropertyInfoStore
+        *
         * @return PropertyInfoStore
         */
        public function getPropertyInfoStore() {
-               static $mockPropertyInfoStore = false;
-               if ( !$mockPropertyInfoStore ) {
-                       $mockPropertyInfoStore = new MockPropertyInfoStore();
+               if ( self::$mockPropertyInfoStore === null ) {
+                       self::$mockPropertyInfoStore = new 
MockPropertyInfoStore();
                }
-               return $mockPropertyInfoStore;
+
+               return self::$mockPropertyInfoStore;
        }
 
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5313b4f774a6a99c8427a2ea4f783d09f0f39eb3
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Hoo man <h...@online.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to