Bene has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/159516

Change subject: Add an initServices method to SpecialWikibaseRepoPage
......................................................................

Add an initServices method to SpecialWikibaseRepoPage

The SpecialWikibaseRepoPage basically misuses inheritance to share
code. This should and must be fixed before we can properly test
the other special pages.

Change-Id: Icfbe1e494c6cf746b66a692cc45e6273cddac704
---
M repo/includes/specials/SpecialWikibaseRepoPage.php
1 file changed, 27 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/16/159516/1

diff --git a/repo/includes/specials/SpecialWikibaseRepoPage.php 
b/repo/includes/specials/SpecialWikibaseRepoPage.php
index bc9940f..5509e2e 100644
--- a/repo/includes/specials/SpecialWikibaseRepoPage.php
+++ b/repo/includes/specials/SpecialWikibaseRepoPage.php
@@ -46,7 +46,7 @@
        /**
         * @var EntityTitleLookup
         */
-       private $titleLookup;
+       private $entityTitleLookup;
 
        /**
         * @var EntityStore
@@ -73,13 +73,30 @@
                parent::__construct( $title, $restriction );
                $wikibaseRepo = WikibaseRepo::getDefaultInstance();
 
-               //TODO: allow overriding services for testing
-               $this->summaryFormatter = $wikibaseRepo->getSummaryFormatter();
-               $this->entityRevisionLookup = 
$wikibaseRepo->getEntityRevisionLookup( 'uncached' );
-               $this->titleLookup = $wikibaseRepo->getEntityTitleLookup();
-               $this->entityStore = $wikibaseRepo->getEntityStore();
-               $this->permissionChecker = 
$wikibaseRepo->getEntityPermissionChecker();
-               $this->siteStore = $wikibaseRepo->getSiteStore();
+               $this->initServices(
+                       $wikibaseRepo->getSummaryFormatter(),
+                       $wikibaseRepo->getEntityRevisionLookup( 'uncached' ),
+                       $wikibaseRepo->getEntityTitleLookup(),
+                       $wikibaseRepo->getEntityStore(),
+                       $wikibaseRepo->getEntityPermissionChecker(),
+                       $wikibaseRepo->getSiteStore()
+               );
+       }
+
+       public function initServices(
+               SummaryFormatter $summaryFormatter,
+               EntityRevisionLookup $entityRevisionLookup,
+               EntityTitleLookup $entityTitleLookup,
+               EntityStore $entityStore,
+               EntityPermissonChecker $permissionChecker,
+               SiteStore $siteStore
+       ) {
+               $this->summaryFormatter = $summaryFormatter;
+               $this->entityRevisionLookup = $entityRevisionLookup;
+               $this->entityTitleLookup = $entityTitleLookup;
+               $this->entityStore = $entityStore;
+               $this->permissionChecker = $permissionChecker;
+               $this->siteStore = $siteStore;
        }
 
        /**
@@ -177,7 +194,7 @@
         * @return null|Title
         */
        protected function getEntityTitle( EntityId $id ) {
-               return $this->titleLookup->getTitleForId( $id );
+               return $this->entityTitleLookup->getTitleForId( $id );
        }
 
        /**
@@ -193,7 +210,7 @@
         */
        protected function saveEntity( Entity $entity, Summary $summary, 
$token, $flags = EDIT_UPDATE, $baseRev = false ) {
                $editEntity = new EditEntity(
-                       $this->titleLookup,
+                       $this->entityTitleLookup,
                        $this->entityRevisionLookup,
                        $this->entityStore,
                        $this->permissionChecker,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icfbe1e494c6cf746b66a692cc45e6273cddac704
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Bene <[email protected]>

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

Reply via email to