Thiemo Mättig (WMDE) has uploaded a new change for review.

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

Change subject: Add UnDeserializableValue to DataModelSerializationRoundtripTest
......................................................................

Add UnDeserializableValue to DataModelSerializationRoundtripTest

This roundtrip test failed because both the new and the legacy
unserializer (in Lib) checked the hash. This can't work if the
hash was (partly) created by the UnDeserializableValue class.

All hash ckecks are now removed from the new serializer.

This removes the last remaining check from the old serializer. See
https://github.com/wmde/WikibaseDataModelSerialization/commit/f993c186

Bug: 66839
Bug: 68565
Change-Id: I002e1024275e2270c3de94eda4b66aee792e00fb
---
M lib/includes/serializers/ReferenceSerializer.php
M lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php
2 files changed, 4 insertions(+), 9 deletions(-)


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

diff --git a/lib/includes/serializers/ReferenceSerializer.php 
b/lib/includes/serializers/ReferenceSerializer.php
index f87139a..1535b6d 100644
--- a/lib/includes/serializers/ReferenceSerializer.php
+++ b/lib/includes/serializers/ReferenceSerializer.php
@@ -111,10 +111,6 @@
 
                $reference = new Reference( new SnakList( $snakList ) );
 
-               if ( array_key_exists( 'hash', $serialization ) && 
$serialization['hash'] !== $reference->getHash() ) {
-                       throw new InvalidArgumentException( 'If a hash is 
present in a reference serialization it needs to be correct' );
-               }
-
                return $reference;
        }
 
diff --git 
a/lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php 
b/lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php
index e037ff7..982a8bf 100644
--- a/lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php
+++ b/lib/tests/phpunit/serializers/DataModelSerializationRoundtripTest.php
@@ -27,7 +27,6 @@
 use Wikibase\Lib\Serializers\SerializationOptions;
 
 /**
- * @todo Fix the UnDeserializableValue test.
  * @todo Is something special needed to test ordering?
  * @todo Add tests with $options->setIndexTags( true ).
  *
@@ -201,10 +200,10 @@
                                new PropertyId( $baseId . '4' ),
                                new StringValue( 'string-value' )
                        ),
-                       //new PropertyValueSnak(
-                       //      new PropertyId( $baseId . '5' ),
-                       //      new UnDeserializableValue( 
'undeserializable-data', 'unsupported', 'error' )
-                       //),
+                       new PropertyValueSnak(
+                               new PropertyId( $baseId . '5' ),
+                               new UnDeserializableValue( 
'undeserializable-data', 'string', 'error' )
+                       ),
                        new PropertyValueSnak(
                                new PropertyId( $baseId . '6' ),
                                new UnknownValue( 'unknown-value' )

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I002e1024275e2270c3de94eda4b66aee792e00fb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.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