From 0652cd3c323c72eea6f14d0a3a8c08d3a069ea2e Mon Sep 17 00:00:00 2001 From: Bene Date: Wed, 9 Mar 2016 21:07:37 +0100 Subject: [PATCH] Add compatibility with DataModel 6.0 --- README.md | 4 ++++ composer.json | 4 ++-- mediawiki-extension.json | 2 +- .../unit/Deserializers/LegacyItemDeserializerTest.php | 7 ++++--- .../Deserializers/LegacyPropertyDeserializerTest.php | 10 +++++++--- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index a5caba5..3723755 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,10 @@ Wikibase Internal Serialization has been written by [Jeroen De Dauw] ## Release notes +### 2.3.0 (2016-03-11) + +* Added compatibility with Wikibase DataModel 6.x + ### 2.2.0 (2016-03-03) * `DeserializerFactory` constructor now optionally takes a `DispatchableDeserializer` as third argument diff --git a/composer.json b/composer.json index bb8ccce..4c29ad2 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ }, "require": { "php": ">=5.3.0", - "wikibase/data-model": "~5.0|~4.2", + "wikibase/data-model": "~6.0|~5.0|~4.2", "wikibase/data-model-serialization": "~2.0", "serialization/serialization": "~3.2" }, @@ -46,7 +46,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.2.x-dev" + "dev-master": "2.3.x-dev" } }, "scripts": { diff --git a/mediawiki-extension.json b/mediawiki-extension.json index c52097e..646bf7f 100644 --- a/mediawiki-extension.json +++ b/mediawiki-extension.json @@ -5,7 +5,7 @@ ], "url": "https://github.com/wmde/WikibaseInternalSerialization", "description": "Serializers and deserializers for the data access layer of Wikibase Repository", - "version": "2.2.0", + "version": "2.3.0", "license-name": "GPL-2.0+", "type": "wikibase", "manifest_version": 1 diff --git a/tests/unit/Deserializers/LegacyItemDeserializerTest.php b/tests/unit/Deserializers/LegacyItemDeserializerTest.php index 530331d..836c7f6 100644 --- a/tests/unit/Deserializers/LegacyItemDeserializerTest.php +++ b/tests/unit/Deserializers/LegacyItemDeserializerTest.php @@ -115,6 +115,7 @@ private function assertDeserialization( $serialization, Item $expectedItem ) { /** * @param string $serialization + * * @return Item */ private function itemFromSerialization( $serialization ) { @@ -173,7 +174,7 @@ public function testGivenStatementWithLegacyKey_itemHasStatement() { public function testGivenLabels_getLabelsReturnsThem( array $labels ) { $item = $this->itemFromSerialization( array( 'label' => $labels ) ); - $this->assertEquals( $labels, $item->getLabels() ); + $this->assertEquals( $labels, $item->getLabels()->toTextArray() ); } public function TermListProvider() { @@ -198,7 +199,7 @@ public function testGivenInvalidLabels_exceptionIsThrown() { public function testGivenDescriptions_getDescriptionsReturnsThem( array $descriptions ) { $item = $this->itemFromSerialization( array( 'description' => $descriptions ) ); - $this->assertEquals( $descriptions, $item->getDescriptions() ); + $this->assertEquals( $descriptions, $item->getDescriptions()->toTextArray() ); } public function testGivenInvalidAliases_exceptionIsThrown() { @@ -212,7 +213,7 @@ public function testGivenInvalidAliases_exceptionIsThrown() { public function testGivenAliases_getAliasesReturnsThem( array $aliases ) { $item = $this->itemFromSerialization( array( 'aliases' => $aliases ) ); - $this->assertEquals( $aliases, $item->getAllAliases() ); + $this->assertEquals( $aliases, $item->getAliasGroups()->toTextArray() ); } public function aliasesListProvider() { diff --git a/tests/unit/Deserializers/LegacyPropertyDeserializerTest.php b/tests/unit/Deserializers/LegacyPropertyDeserializerTest.php index 9d81628..332249b 100644 --- a/tests/unit/Deserializers/LegacyPropertyDeserializerTest.php +++ b/tests/unit/Deserializers/LegacyPropertyDeserializerTest.php @@ -3,6 +3,7 @@ namespace Tests\Wikibase\InternalSerialization\Deserializers; use Deserializers\Deserializer; +use Wikibase\DataModel\Entity\Property; use Wikibase\DataModel\Entity\PropertyId; use Wikibase\DataModel\Entity\BasicEntityIdParser; use Wikibase\InternalSerialization\Deserializers\LegacyEntityIdDeserializer; @@ -87,12 +88,13 @@ public function testGivenValidPropertyIdId_propertyIdIsSet() { * @dataProvider TermListProvider */ public function testGivenLabels_getLabelsReturnsThem( array $labels ) { + /** @var Property $property */ $property = $this->deserializer->deserialize( array( 'datatype' => 'foo', 'label' => $labels ) ); - $this->assertEquals( $labels, $property->getLabels() ); + $this->assertEquals( $labels, $property->getLabels()->toTextArray() ); } public function TermListProvider() { @@ -115,12 +117,13 @@ public function testGivenInvalidLabels_exceptionIsThrown() { * @dataProvider TermListProvider */ public function testGivenDescriptions_getDescriptionsReturnsThem( array $descriptions ) { + /** @var Property $property */ $property = $this->deserializer->deserialize( array( 'datatype' => 'foo', 'description' => $descriptions ) ); - $this->assertEquals( $descriptions, $property->getDescriptions() ); + $this->assertEquals( $descriptions, $property->getDescriptions()->toTextArray() ); } public function testGivenInvalidAliases_exceptionIsThrown() { @@ -132,12 +135,13 @@ public function testGivenInvalidAliases_exceptionIsThrown() { * @dataProvider aliasesListProvider */ public function testGivenAliases_getAliasesReturnsThem( array $aliases ) { + /** @var Property $property */ $property = $this->deserializer->deserialize( array( 'datatype' => 'foo', 'aliases' => $aliases ) ); - $this->assertEquals( $aliases, $property->getAllAliases() ); + $this->assertEquals( $aliases, $property->getAliasGroups()->toTextArray() ); } public function aliasesListProvider() {