Skip to content

Commit

Permalink
Merge pull request #104 from wmde/dm6.0
Browse files Browse the repository at this point in the history
Add compatibility with DataModel 6.0
  • Loading branch information
thiemowmde committed Mar 11, 2016
2 parents abee42e + 0652cd3 commit 78f3c73
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -46,7 +46,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.2.x-dev"
"dev-master": "2.3.x-dev"
}
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion mediawiki-extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/Deserializers/LegacyItemDeserializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ private function assertDeserialization( $serialization, Item $expectedItem ) {

/**
* @param string $serialization
*
* @return Item
*/
private function itemFromSerialization( $serialization ) {
Expand Down Expand Up @@ -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() {
Expand All @@ -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() {
Expand All @@ -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() {
Expand Down
10 changes: 7 additions & 3 deletions tests/unit/Deserializers/LegacyPropertyDeserializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand All @@ -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() {
Expand All @@ -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() {
Expand Down

0 comments on commit 78f3c73

Please sign in to comment.