diff --git a/.travis.yml b/.travis.yml index 9e43816e..a7da435e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ matrix: php: 5.6 - env: DM=~4.2 php: 7 - - env: DM=~4.2 + - env: DM=~7.0 php: hhvm allow_failures: - env: DM=@dev diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 3694d3bc..8b5ebee6 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,9 @@ # Wikibase DataModel Serialization release notes +## 2.4.0 (2017-03-16) + +* Added compatibility with Wikibase DataModel 7.x + ## 2.3.0 (2017-02-15) * Improved performance of `StatementDeserializer` as well as other deserializers diff --git a/composer.json b/composer.json index 957fcedf..8acb4b63 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ }, "require": { "php": ">=5.5.0", - "wikibase/data-model": "~6.0|~5.0|~4.2", + "wikibase/data-model": "~7.0|~6.0|~5.0|~4.2", "serialization/serialization": "~3.1", "data-values/serialization": "~1.0" }, @@ -53,7 +53,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "2.4.x-dev" } }, "scripts": { diff --git a/mediawiki-extension.json b/mediawiki-extension.json index 4efc3b5b..cc01ab74 100644 --- a/mediawiki-extension.json +++ b/mediawiki-extension.json @@ -6,7 +6,7 @@ ], "url": "https://github.com/wmde/WikibaseDataModelSerialization", "description": "Serializers and deserializers for the Wikibase DataModel", - "version": "2.3.0", + "version": "2.4.0", "type": "wikibase", "license-name": "GPL-2.0+", "manifest_version": 1 diff --git a/src/SerializerFactory.php b/src/SerializerFactory.php index ed841c84..00b254dd 100644 --- a/src/SerializerFactory.php +++ b/src/SerializerFactory.php @@ -221,10 +221,7 @@ public function newSnakListSerializer( $serializeSnaksWithHash = true ) { * @return Serializer */ public function newSnakSerializer( $serializeWithHash = true ) { - return new SnakSerializer( - $this->dataValueSerializer, - $serializeWithHash - ); + return new SnakSerializer( $this->dataValueSerializer, $serializeWithHash ); } /** diff --git a/tests/unit/Serializers/SnakSerializerTest.php b/tests/unit/Serializers/SnakSerializerTest.php index 6e624a4c..8ef66f1a 100644 --- a/tests/unit/Serializers/SnakSerializerTest.php +++ b/tests/unit/Serializers/SnakSerializerTest.php @@ -19,7 +19,8 @@ class SnakSerializerTest extends DispatchableSerializerTest { protected function buildSerializer() { - return new SnakSerializer( new DataValueSerializer() ); + $serializeWithHash = false; + return new SnakSerializer( new DataValueSerializer(), $serializeWithHash ); } public function serializableProvider() { @@ -56,7 +57,6 @@ public function serializationProvider() { array( 'snaktype' => 'novalue', 'property' => 'P42', - 'hash' => '5c33520fbfb522444868b4168a35d4b919370018' ), new PropertyNoValueSnak( 42 ) ), @@ -64,7 +64,6 @@ public function serializationProvider() { array( 'snaktype' => 'somevalue', 'property' => 'P42', - 'hash' => '1c5c4a30999292cd6592a7a6530322d095fc62d4' ), new PropertySomeValueSnak( 42 ) ), @@ -72,7 +71,6 @@ public function serializationProvider() { array( 'snaktype' => 'value', 'property' => 'P42', - 'hash' => 'f39228cb4e94174c87e966c32b02ad93b3512fce', 'datavalue' => array( 'value' => 'hax', 'type' => 'string', @@ -83,13 +81,15 @@ public function serializationProvider() { ); } - public function testSnakSerializationWithoutHash() { - $serializer = new SnakSerializer( new DataValueSerializer(), false ); + public function testSnakSerializationWithHash() { + $serializer = new SnakSerializer( new DataValueSerializer() ); $snak = new PropertyValueSnak( 42, new StringValue( 'hax' ) ); $serialization = $serializer->serialize( $snak ); - $this->assertArrayNotHasKey( 'hash', $serialization ); + $this->assertArrayHasKey( 'hash', $serialization ); + $this->assertInternalType( 'string', $serialization['hash'] ); + $this->assertNotEmpty( $serialization['hash'] ); } }