Addshore has uploaded a new change for review.

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

Change subject: Remove LibSerializerFactory from SetClaimTest
......................................................................

Remove LibSerializerFactory from SetClaimTest

This is the final use of this factory in the
API and API tests.

YAY

Change-Id: I9b3ba692442ab4854fa0e05d5a363c7255b9ae3c
---
M repo/tests/phpunit/includes/api/SetClaimTest.php
1 file changed, 10 insertions(+), 8 deletions(-)


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

diff --git a/repo/tests/phpunit/includes/api/SetClaimTest.php 
b/repo/tests/phpunit/includes/api/SetClaimTest.php
index d8b70d7..42a10f2 100644
--- a/repo/tests/phpunit/includes/api/SetClaimTest.php
+++ b/repo/tests/phpunit/includes/api/SetClaimTest.php
@@ -3,6 +3,7 @@
 namespace Wikibase\Test\Repo\Api;
 
 use DataValues\NumberValue;
+use DataValues\Serializers\DataValueSerializer;
 use DataValues\StringValue;
 use FormatJson;
 use UsageException;
@@ -19,6 +20,7 @@
 use Wikibase\DataModel\Snak\Snak;
 use Wikibase\DataModel\Snak\SnakList;
 use Wikibase\DataModel\Statement\Statement;
+use Wikibase\InternalSerialization\SerializerFactory;
 use Wikibase\Lib\ClaimGuidGenerator;
 use Wikibase\Lib\Serializers\LibSerializerFactory;
 use Wikibase\Lib\Serializers\SerializationOptions;
@@ -146,9 +148,9 @@
                                // Simply reorder the qualifiers by putting the 
first qualifier to the end. This is
                                // supposed to be done in the serialized 
representation since changing the actual
                                // object might apply intrinsic sorting.
-                               $serializerFactory = new LibSerializerFactory();
-                               $serializer = 
$serializerFactory->newClaimSerializer( new SerializationOptions() );
-                               $serializedClaim = $serializer->getSerialized( 
$statement );
+                               $serializerFactory = new SerializerFactory( new 
DataValueSerializer() );
+                               $statementSerializer = 
$serializerFactory->newStatementSerializer();
+                               $serializedClaim = 
$statementSerializer->serialize( $statement );
                                $firstPropertyId = array_shift( 
$serializedClaim['qualifiers-order'] );
                                array_push( 
$serializedClaim['qualifiers-order'], $firstPropertyId );
                                $this->makeRequest( $serializedClaim, $itemId, 
1, 'reorder qualifiers' );
@@ -296,15 +298,15 @@
                $baserevid = null,
                $error = null
        ) {
-               $serializerFactory = new LibSerializerFactory();
+               $serializerFactory = new SerializerFactory( new 
DataValueSerializer() );
+               $statementSerializer = 
$serializerFactory->newStatementSerializer();
+               $statementDeserializer = 
WikibaseRepo::getDefaultInstance()->getStatementDeserializer();
 
                if ( $claim instanceof Statement ) {
-                       $serializer = $serializerFactory->newClaimSerializer( 
new SerializationOptions() );
-                       $serializedClaim = $serializer->getSerialized( $claim );
+                       $serializedClaim = $statementSerializer->serialize( 
$claim );
                } else {
-                       $unserializer = 
$serializerFactory->newClaimUnserializer( new SerializationOptions() );
                        $serializedClaim = $claim;
-                       $claim = $unserializer->newFromSerialization( 
$serializedClaim );
+                       $claim = $statementDeserializer->deserialize( 
$serializedClaim );
                }
 
                $params = array(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b3ba692442ab4854fa0e05d5a363c7255b9ae3c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Addshore <addshorew...@gmail.com>

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

Reply via email to