Aude has uploaded a new change for review.

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

Change subject: Remove deprecated WikibaseClient::getEntityIdFormatter method
......................................................................

Remove deprecated WikibaseClient::getEntityIdFormatter method

removed all usages of the method

Change-Id: I3e4088634567fdaf9c51811fe2d1cb4217e3be14
---
M client/includes/EntityIdPropertyUpdater.php
M client/includes/WikibaseClient.php
M client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
M client/includes/scribunto/WikibaseLuaBindings.php
M client/tests/phpunit/includes/ChangeHandlerTest.php
M client/tests/phpunit/includes/WikibaseClientTest.php
M client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
7 files changed, 12 insertions(+), 41 deletions(-)


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

diff --git a/client/includes/EntityIdPropertyUpdater.php 
b/client/includes/EntityIdPropertyUpdater.php
index f3ca879..49e876b 100644
--- a/client/includes/EntityIdPropertyUpdater.php
+++ b/client/includes/EntityIdPropertyUpdater.php
@@ -52,8 +52,7 @@
                $itemId = $this->siteLinkLookup->getEntityIdForSiteLink( 
$siteLink );
 
                if ( $itemId instanceof EntityId ) {
-                       $idFormatter = 
WikibaseClient::getDefaultInstance()->getEntityIdFormatter();
-                       $out->setProperty( 'wikibase_item', 
$idFormatter->format( $itemId ) );
+                       $out->setProperty( 'wikibase_item', 
$itemId->getSerialization() );
                } else {
                        // unset property, if it was set
                        $this->unsetProperty( $out, 'wikibase_item' );
diff --git a/client/includes/WikibaseClient.php 
b/client/includes/WikibaseClient.php
index 1ec9421..db4db48 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -173,18 +173,6 @@
        /**
         * @since 0.4
         *
-        * @deprecated use EntityId::getSerialization() for the canonical 
representation, or
-        * go via getValueFormatterFactory() to get a fancy formatter for 
EntityIds.
-        *
-        * @return EntityIdFormatter
-        */
-       public function getEntityIdFormatter() {
-               return new EntityIdFormatter( new FormatterOptions() );
-       }
-
-       /**
-        * @since 0.4
-        *
         * @param string $languageCode
         *
         * @return EntityIdLabelFormatter
diff --git a/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php 
b/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
index 7ab5b96..2ebf8b7 100644
--- a/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
+++ b/client/includes/scribunto/Scribunto_LuaWikibaseLibrary.php
@@ -36,7 +36,6 @@
                $this->wbLibrary = new WikibaseLuaBindings(
                        $wikibaseClient->getEntityIdParser(),
                        $wikibaseClient->getStore()->getEntityLookup(),
-                       $wikibaseClient->getEntityIdFormatter(),
                        $wikibaseClient->getStore()->getSiteLinkTable(),
                        $wikibaseClient->getLanguageFallbackChainFactory(),
                        $language,
diff --git a/client/includes/scribunto/WikibaseLuaBindings.php 
b/client/includes/scribunto/WikibaseLuaBindings.php
index 07261e3..8fa3bb7 100644
--- a/client/includes/scribunto/WikibaseLuaBindings.php
+++ b/client/includes/scribunto/WikibaseLuaBindings.php
@@ -30,9 +30,6 @@
        /* @var EntityLookup */
        private $entityLookup;
 
-       /* @var EntityIdFormatter */
-       private $entityIdFormatter;
-
        /* @var SiteLinkLookup */
        private $siteLinkTable;
 
@@ -51,7 +48,6 @@
        /**
         * @param EntityIdParser $entityIdParser
         * @param EntityLookup $entityLookup
-        * @param EntityIdFormatter $entityIdFormatter
         * @param SiteLinkLookup $siteLinkTable
         * @param LanguageFallbackChainFactory $fallbackChainFactory
         * @param Language $language
@@ -61,7 +57,6 @@
        public function __construct(
                EntityIdParser $entityIdParser,
                EntityLookup $entityLookup,
-               EntityIdFormatter $entityIdFormatter,
                SiteLinkLookup $siteLinkTable,
                LanguageFallbackChainFactory $fallbackChainFactory,
                Language $language,
@@ -70,7 +65,6 @@
        ) {
                $this->entityIdParser = $entityIdParser;
                $this->entityLookup = $entityLookup;
-               $this->entityIdFormatter = $entityIdFormatter;
                $this->siteLinkTable = $siteLinkTable;
                $this->fallbackChainFactory = $fallbackChainFactory;
                $this->language = $language;
@@ -185,7 +179,7 @@
                        return null;
                }
 
-               return $this->entityIdFormatter->format( $id );
+               return $id->getSerialization();
        }
 
        /**
diff --git a/client/tests/phpunit/includes/ChangeHandlerTest.php 
b/client/tests/phpunit/includes/ChangeHandlerTest.php
index 8a49377..bcd9469 100644
--- a/client/tests/phpunit/includes/ChangeHandlerTest.php
+++ b/client/tests/phpunit/includes/ChangeHandlerTest.php
@@ -429,20 +429,17 @@
        /**
         * @todo: move to TestChanges, unify with TestChanges::getChanges()
         */
-       public static function makeTestChanges( $userId, $entityId ) {
-               $entity = Item::newEmpty();
-               $entity->setId( new ItemId( 'q' . $entityId ) );
+       public static function makeTestChanges( $userId, $numericId ) {
+               $prefixedId = 'Q' . $numericId;
 
-               $offset = 100 * $entityId + 1000 * $userId;
-
-               $idFormatter = 
WikibaseClient::getDefaultInstance()->getEntityIdFormatter();
+               $offset = 100 * $numericId + 1000 * $userId;
 
                // create with a label and site link set
                $create = self::makeChange( array(
                        'id' => $offset + 1,
                        'type' => 'wikibase-item~add',
                        'time' => '20130101010101',
-                       'object_id' => $idFormatter->format( $entity->getId() ),
+                       'object_id' => $prefixedId,
                        'revision_id' => $offset + 11,
                        'user_id' => $userId,
                ), self::makeDiff( Item::ENTITY_TYPE,
@@ -458,7 +455,7 @@
                        'id' => $offset + 23,
                        'type' => 'wikibase-item~update',
                        'time' => '20130102020202',
-                       'object_id' => $idFormatter->format( $entity->getId() ),
+                       'object_id' => $prefixedId,
                        'revision_id' => $offset + 12,
                        'user_id' => $userId,
                ), self::makeDiff( Item::ENTITY_TYPE,
@@ -495,7 +492,7 @@
                        'id' => $offset + 14,
                        'type' => 'wikibase-item~update',
                        'time' => '20130101020304',
-                       'object_id' => $idFormatter->format( $entity->getId() ),
+                       'object_id' => $prefixedId,
                        'revision_id' => $offset + 13,
                        'user_id' => $userId,
                ), self::makeDiff( Item::ENTITY_TYPE,
@@ -535,7 +532,7 @@
                        'id' => $offset + 12,
                        'type' => 'wikibase-item~update',
                        'time' => '20130103030303',
-                       'object_id' => $idFormatter->format( $entity->getId() ),
+                       'object_id' => $prefixedId,
                        'revision_id' => $offset + 14,
                        'user_id' => $userId + 17,
                ), self::makeDiff( Item::ENTITY_TYPE,
@@ -550,7 +547,7 @@
                        'id' => $offset + 13,
                        'type' => 'wikibase-item~update',
                        'time' => '20130102030405',
-                       'object_id' => $idFormatter->format( $entity->getId() ),
+                       'object_id' => $prefixedId,
                        'revision_id' => $offset + 17,
                        'user_id' => $userId,
                ), self::makeDiff( Item::ENTITY_TYPE,
@@ -567,7 +564,7 @@
                        'id' => $offset + 14,
                        'type' => 'wikibase-item~update',
                        'time' => '20130102030405',
-                       'object_id' => $idFormatter->format( $entity->getId() ),
+                       'object_id' => $prefixedId,
                        'revision_id' => $offset + 18,
                        'user_id' => $userId,
                ), self::makeDiff( Item::ENTITY_TYPE,
@@ -584,7 +581,7 @@
                        'id' => $offset + 35,
                        'type' => 'wikibase-item~remove',
                        'time' => '20130105050505',
-                       'object_id' => $idFormatter->format( $entity->getId() ),
+                       'object_id' => $prefixedId,
                        'revision_id' => 0,
                        'user_id' => $userId,
                ), self::makeDiff( Item::ENTITY_TYPE,
diff --git a/client/tests/phpunit/includes/WikibaseClientTest.php 
b/client/tests/phpunit/includes/WikibaseClientTest.php
index b06dbff..7764fbf 100644
--- a/client/tests/phpunit/includes/WikibaseClientTest.php
+++ b/client/tests/phpunit/includes/WikibaseClientTest.php
@@ -34,11 +34,6 @@
                $this->assertInstanceOf( 
'Wikibase\DataModel\Entity\EntityIdParser', $returnValue );
        }
 
-       public function testGetEntityIdFormatterReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getEntityIdFormatter();
-               $this->assertInstanceOf( 'Wikibase\Lib\EntityIdFormatter', 
$returnValue );
-       }
-
        public function testEntityIdLabelFormatterReturnType() {
                $returnValue = 
$this->getDefaultInstance()->newEntityIdLabelFormatter( 'en' );
                $this->assertInstanceOf( 'Wikibase\Lib\EntityIdLabelFormatter', 
$returnValue );
diff --git 
a/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php 
b/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
index 8108431..0b5bdc4 100644
--- a/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
+++ b/client/tests/phpunit/includes/scribunto/WikibaseLuaBindingsTest.php
@@ -53,7 +53,6 @@
                return new WikibaseLuaBindings(
                        new BasicEntityIdParser(),
                        $entityLookup ? $entityLookup : new MockRepository(),
-                       new EntityIdFormatter( new FormatterOptions() ),
                        $siteLinkTable,
                        new LanguageFallbackChainFactory(),
                        $language, // language

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e4088634567fdaf9c51811fe2d1cb4217e3be14
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <aude.w...@gmail.com>

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

Reply via email to