Skip to content

Commit

Permalink
Merge pull request #198 from wmde/dm8
Browse files Browse the repository at this point in the history
 Add compatibility with DataModel 8.x
  • Loading branch information
JeroenDeDauw authored Aug 8, 2018
2 parents ef5449c + f9ee124 commit af2f208
Show file tree
Hide file tree
Showing 18 changed files with 49 additions and 46 deletions.
21 changes: 7 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
language: php

dist: trusty

env:
- THENEEDFORTHIS=FAIL

matrix:
fast_finish: true
include:
- env: DM=@dev
php: 5.5
- env: DM=~6.3
php: 5.5
- env: DM=~6.3
php: hhvm
- env: DM=~7.5
php: 5.6
- env: DM=~6.3
- env: DM=~7.5
php: 7
- env: DM=~6.3
php: hhvm
exclude:
- env: THENEEDFORTHIS=FAIL
- env: DM=~8.0
php: 7.1
- env: DM=@dev
php: 7.2
allow_failures:
- env: DM=@dev

Expand Down
6 changes: 6 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Wikibase DataModel Services release notes

## Version 3.11.0 (2018-08-07)

* Added compatibility with Wikibase DataModel 8.x
* Added compatibility with DataValues 2.x
* Raised minimum PHP version to 5.6

## Version 3.10.0 (2018-05-31)

* Added `ReferencedEntityIdLookup` interface, along with:
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
"irc": "irc://irc.freenode.net/wikidata"
},
"require": {
"php": ">=5.5.9",
"wikibase/data-model": "~7.0|~6.3",
"data-values/data-values": "~0.1|~1.0",
"php": ">=5.6.0",
"wikibase/data-model": "~8.0|~7.0|~6.3",
"data-values/data-values": "~2.0|~1.0",
"diff/diff": "~2.3|~1.0",
"wikimedia/assert": "~0.2.2"
},
"require-dev": {
"phpmd/phpmd": "~2.3",
"phpunit/phpunit": "~4.8",
"phpunit/phpunit": "~5.7",
"wikibase/wikibase-codesniffer": "^0.3.0"
},
"autoload": {
Expand All @@ -38,7 +38,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "3.10.x-dev"
"dev-master": "3.11.x-dev"
}
},
"scripts": {
Expand Down
10 changes: 6 additions & 4 deletions tests/fixtures/EntityOfUnknownType.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ public function isEmpty() {
/**
* @see EntityDocument::equals
*
* @since 3.3
*
* @param mixed $target
*
* @return bool Always true.
Expand All @@ -53,12 +51,16 @@ public function equals( $target ) {
/**
* @see EntityDocument::copy
*
* @since 3.3
*
* @return self
*/
public function copy() {
return $this;
}

/**
* @see EntityDocument::clear
*/
public function clear() {
}

}
10 changes: 6 additions & 4 deletions tests/fixtures/FakeEntityDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ public function isEmpty() {
/**
* @see EntityDocument::equals
*
* @since 3.3
*
* @param mixed $target
*
* @return bool Always true.
Expand All @@ -64,12 +62,16 @@ public function equals( $target ) {
/**
* @see EntityDocument::copy
*
* @since 3.3
*
* @return self
*/
public function copy() {
return new self( $this->id );
}

/**
* @see EntityDocument::clear
*/
public function clear() {
}

}
2 changes: 1 addition & 1 deletion tests/unit/ByPropertyIdGrouperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private function getPropertyIdProviders() {
* @return PropertyIdProvider
*/
private function getPropertyIdProviderMock( $propertyId, $type = null ) {
$propertyIdProvider = $this->getMock( Snak::class );
$propertyIdProvider = $this->createMock( Snak::class );

$propertyIdProvider->expects( $this->once() )
->method( 'getPropertyId' )
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/EntityId/EntityIdLabelFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testParseWithValidArguments( EntityId $entityId, $languageCode,
* @return LabelLookup
*/
private function getLabelLookup( $languageCode ) {
$labelLookup = $this->getMock( LabelLookup::class );
$labelLookup = $this->createMock( LabelLookup::class );

$labelLookup->expects( $this->any() )
->method( 'getLabel' )
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/EntityId/EscapingEntityIdFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class EscapingEntityIdFormatterTest extends PHPUnit_Framework_TestCase {

public function testFormat() {
$entityIdFormatter = $this->getMock( EntityIdFormatter::class );
$entityIdFormatter = $this->createMock( EntityIdFormatter::class );
$entityIdFormatter->expects( $this->once() )
->method( 'formatEntityId' )
->will( $this->returnValue( 'Q1 is &%$;§ > Q2' ) );
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/EntityId/PrefixMappingEntityIdParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function testGivenPrefixIsNotMapped_defaultPrefixIsAddedToIdSerialization
}

public function testEntityIdParsingExceptionsAreNotCaught() {
$regularParser = $this->getMock( EntityIdParser::class );
$regularParser = $this->createMock( EntityIdParser::class );
$regularParser->expects( $this->any() )
->method( 'parse' )
->will( $this->throwException( new EntityIdParsingException() ) );
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Lookup/DisabledEntityTypesEntityLookupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DisabledEntityTypesEntityLookupTest extends \PHPUnit_Framework_TestCase {
* @return EntityLookup
*/
private function getEntityLookup() {
$entityLookup = $this->getMock( EntityLookup::class );
$entityLookup = $this->createMock( EntityLookup::class );

$entityLookup->expects( $this->any() )
->method( 'hasEntity' )
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Lookup/DispatchingEntityLookupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function testGivenEntityIdFromUnknownRepository_getEntityReturnsNull() {
* @return EntityLookup
*/
private function getExceptionThrowingLookup( Exception $exception ) {
$lookup = $this->getMock( EntityLookup::class );
$lookup = $this->createMock( EntityLookup::class );
$lookup->expects( $this->any() )
->method( $this->anything() )
->will( $this->throwException( $exception ) );
Expand Down Expand Up @@ -120,7 +120,7 @@ public function testGivenNotExistingEntityIdFromKnownRepository_hasEntityReturns
}

public function testGivenEntityIdFromUnknownRepository_hasEntityReturnsFalse() {
$dispatchingLookup = new DispatchingEntityLookup( [ '' => $this->getMock( EntityLookup::class ), ] );
$dispatchingLookup = new DispatchingEntityLookup( [ '' => $this->createMock( EntityLookup::class ), ] );

$this->assertFalse( $dispatchingLookup->hasEntity( new ItemId( 'foo:Q1' ) ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class EntityRetrievingClosestReferencedEntityIdLookupTest extends PHPUnit_Framew
* @return EntityLookup
*/
private function restrictEntityLookup( EntityLookup $entityLookup, $expectedNumberOfGetEntityCalls = null ) {
$entityLookupMock = $this->getMock( EntityLookup::class );
$entityLookupMock = $this->createMock( EntityLookup::class );

$entityLookupMock->expects(
$expectedNumberOfGetEntityCalls === null ? $this->any() : $this->exactly( $expectedNumberOfGetEntityCalls )
Expand All @@ -56,7 +56,7 @@ private function restrictEntityLookup( EntityLookup $entityLookup, $expectedNumb
* @return EntityPrefetcher
*/
private function newEntityPrefetcher( $expectedPrefetches ) {
$entityPrefetcher = $this->getMock( EntityPrefetcher::class );
$entityPrefetcher = $this->createMock( EntityPrefetcher::class );
$entityPrefetcher->expects( $this->exactly( $expectedPrefetches ) )
->method( 'prefetch' )
->with( $this->isType( 'array' ) );
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/Lookup/InProcessCachingDataTypeLookupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class InProcessCachingDataTypeLookupTest extends PHPUnit_Framework_TestCase {

public function testWhenCacheIsEmpty_decoratedLookupValueIsReturned() {
$decoratedLookup = $this->getMock( PropertyDataTypeLookup::class );
$decoratedLookup = $this->createMock( PropertyDataTypeLookup::class );

$decoratedLookup->expects( $this->once() )
->method( 'getDataTypeIdForProperty' )
Expand All @@ -32,7 +32,7 @@ public function testWhenCacheIsEmpty_decoratedLookupValueIsReturned() {
}

public function testWhenValueInCache_cacheValueIsReturned() {
$decoratedLookup = $this->getMock( PropertyDataTypeLookup::class );
$decoratedLookup = $this->createMock( PropertyDataTypeLookup::class );

$decoratedLookup->expects( $this->once() )
->method( 'getDataTypeIdForProperty' )
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/Lookup/LanguageLabelDescriptionLookupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class LanguageLabelDescriptionLookupTest extends \PHPUnit_Framework_TestCase {

public function testGetLabelCallsTermLookupAndReturnsStringAsTerm() {
$termLookup = $this->getMock( TermLookup::class );
$termLookup = $this->createMock( TermLookup::class );

$termLookup->expects( $this->once() )
->method( 'getLabel' )
Expand All @@ -32,7 +32,7 @@ public function testGetLabelCallsTermLookupAndReturnsStringAsTerm() {
}

public function testGetDescriptionCallsTermLookupAndReturnsStringAsTerm() {
$termLookup = $this->getMock( TermLookup::class );
$termLookup = $this->createMock( TermLookup::class );

$termLookup->expects( $this->once() )
->method( 'getDescription' )
Expand All @@ -48,7 +48,7 @@ public function testGetDescriptionCallsTermLookupAndReturnsStringAsTerm() {
}

public function testWhenGettingNull_getLabelReturnsNull() {
$termLookup = $this->getMock( TermLookup::class );
$termLookup = $this->createMock( TermLookup::class );

$termLookup->expects( $this->once() )
->method( 'getLabel' )
Expand All @@ -60,7 +60,7 @@ public function testWhenGettingNull_getLabelReturnsNull() {
}

public function testWhenGettingNull_getDescriptionReturnsNull() {
$termLookup = $this->getMock( TermLookup::class );
$termLookup = $this->createMock( TermLookup::class );

$termLookup->expects( $this->once() )
->method( 'getDescription' )
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Lookup/RedirectResolvingEntityLookupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function getEntity( EntityId $id ) {
* @return EntityLookup
*/
public function getLookupDouble() {
$mock = $this->getMock( EntityLookup::class );
$mock = $this->createMock( EntityLookup::class );

$mock->expects( $this->any() )
->method( 'getEntity' )
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Lookup/RestrictedEntityLookupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class RestrictedEntityLookupTest extends \PHPUnit_Framework_TestCase {
* @return EntityLookup
*/
private function getEntityLookup() {
$entityLookup = $this->getMock( EntityLookup::class );
$entityLookup = $this->createMock( EntityLookup::class );

$entityLookup->expects( $this->any() )
->method( 'hasEntity' )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class DataTypeStatementFilterTest extends PHPUnit_Framework_TestCase {
* @return PropertyDataTypeLookup
*/
private function getDataTypeLookup() {
$dataTypeLookup = $this->getMock( PropertyDataTypeLookup::class );
$dataTypeLookup = $this->createMock( PropertyDataTypeLookup::class );

$dataTypeLookup->expects( $this->once() )
->method( 'getDataTypeIdForProperty' )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FilteringStatementGrouperTest extends PHPUnit_Framework_TestCase {
* @return StatementFilter
*/
private function newStatementFilter( $propertyId = 'P1' ) {
$filter = $this->getMock( StatementFilter::class );
$filter = $this->createMock( StatementFilter::class );

$filter->expects( $this->any() )
->method( 'statementMatches' )
Expand Down

0 comments on commit af2f208

Please sign in to comment.