Skip to content

Commit

Permalink
Merge pull request #218 from wmde/release240
Browse files Browse the repository at this point in the history
Release 2.4.0
  • Loading branch information
JeroenDeDauw committed Mar 16, 2017
2 parents 01337b4 + 7df1d61 commit e267bc2
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -53,7 +53,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.3.x-dev"
"dev-master": "2.4.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 @@ -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
Expand Down
5 changes: 1 addition & 4 deletions src/SerializerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

/**
Expand Down
14 changes: 7 additions & 7 deletions tests/unit/Serializers/SnakSerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -56,23 +57,20 @@ public function serializationProvider() {
array(
'snaktype' => 'novalue',
'property' => 'P42',
'hash' => '5c33520fbfb522444868b4168a35d4b919370018'
),
new PropertyNoValueSnak( 42 )
),
array(
array(
'snaktype' => 'somevalue',
'property' => 'P42',
'hash' => '1c5c4a30999292cd6592a7a6530322d095fc62d4'
),
new PropertySomeValueSnak( 42 )
),
array(
array(
'snaktype' => 'value',
'property' => 'P42',
'hash' => 'f39228cb4e94174c87e966c32b02ad93b3512fce',
'datavalue' => array(
'value' => 'hax',
'type' => 'string',
Expand All @@ -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'] );
}

}

0 comments on commit e267bc2

Please sign in to comment.