From 005f6ba51cf1c63f8ac7c3fc51d96d326739b7f3 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Tue, 7 Aug 2018 16:33:24 +0200 Subject: [PATCH 1/3] Add compatibility with DataModel 8.x --- .travis.yml | 21 ++++++--------------- RELEASE-NOTES.md | 5 +++++ composer.json | 6 +++--- tests/fixtures/EntityOfUnknownType.php | 10 ++++++---- tests/fixtures/FakeEntityDocument.php | 10 ++++++---- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index 58c51fab..75d66087 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,25 +1,16 @@ 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: 5.6 - - env: DM=~6.3 - php: 7 - env: DM=~6.3 php: hhvm - exclude: - - env: THENEEDFORTHIS=FAIL + - env: DM=~7.5 + php: 7 + - env: DM=~8.0 + php: 7.1 + - env: DM=@dev + php: 7.2 allow_failures: - env: DM=@dev diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 019e9b31..909c7cb3 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,10 @@ # 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 + ## Version 3.10.0 (2018-05-31) * Added `ReferencedEntityIdLookup` interface, along with: diff --git a/composer.json b/composer.json index 8581beaa..051490ae 100644 --- a/composer.json +++ b/composer.json @@ -21,8 +21,8 @@ }, "require": { "php": ">=5.5.9", - "wikibase/data-model": "~7.0|~6.3", - "data-values/data-values": "~0.1|~1.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" }, @@ -38,7 +38,7 @@ }, "extra": { "branch-alias": { - "dev-master": "3.10.x-dev" + "dev-master": "3.11.x-dev" } }, "scripts": { diff --git a/tests/fixtures/EntityOfUnknownType.php b/tests/fixtures/EntityOfUnknownType.php index 845d11f4..4e59059b 100644 --- a/tests/fixtures/EntityOfUnknownType.php +++ b/tests/fixtures/EntityOfUnknownType.php @@ -40,8 +40,6 @@ public function isEmpty() { /** * @see EntityDocument::equals * - * @since 3.3 - * * @param mixed $target * * @return bool Always true. @@ -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() { + } + } diff --git a/tests/fixtures/FakeEntityDocument.php b/tests/fixtures/FakeEntityDocument.php index c026fe77..b44c7933 100644 --- a/tests/fixtures/FakeEntityDocument.php +++ b/tests/fixtures/FakeEntityDocument.php @@ -51,8 +51,6 @@ public function isEmpty() { /** * @see EntityDocument::equals * - * @since 3.3 - * * @param mixed $target * * @return bool Always true. @@ -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() { + } + } From 31f0c5b12944851cda0aca3becc1768400be2514 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Tue, 7 Aug 2018 16:36:44 +0200 Subject: [PATCH 2/3] Use slightly less ancient PHPUnit --- composer.json | 2 +- tests/unit/ByPropertyIdGrouperTest.php | 2 +- tests/unit/EntityId/EntityIdLabelFormatterTest.php | 2 +- tests/unit/EntityId/EscapingEntityIdFormatterTest.php | 2 +- tests/unit/EntityId/PrefixMappingEntityIdParserTest.php | 2 +- tests/unit/Lookup/DisabledEntityTypesEntityLookupTest.php | 2 +- tests/unit/Lookup/DispatchingEntityLookupTest.php | 4 ++-- ...ntityRetrievingClosestReferencedEntityIdLookupTest.php | 4 ++-- tests/unit/Lookup/InProcessCachingDataTypeLookupTest.php | 4 ++-- tests/unit/Lookup/LanguageLabelDescriptionLookupTest.php | 8 ++++---- tests/unit/Lookup/RedirectResolvingEntityLookupTest.php | 2 +- tests/unit/Lookup/RestrictedEntityLookupTest.php | 2 +- .../unit/Statement/Filter/DataTypeStatementFilterTest.php | 2 +- .../Statement/Grouper/FilteringStatementGrouperTest.php | 2 +- 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/composer.json b/composer.json index 051490ae..644d1d14 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ }, "require-dev": { "phpmd/phpmd": "~2.3", - "phpunit/phpunit": "~4.8", + "phpunit/phpunit": "~5.7", "wikibase/wikibase-codesniffer": "^0.3.0" }, "autoload": { diff --git a/tests/unit/ByPropertyIdGrouperTest.php b/tests/unit/ByPropertyIdGrouperTest.php index 538a9915..ed3647d2 100644 --- a/tests/unit/ByPropertyIdGrouperTest.php +++ b/tests/unit/ByPropertyIdGrouperTest.php @@ -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' ) diff --git a/tests/unit/EntityId/EntityIdLabelFormatterTest.php b/tests/unit/EntityId/EntityIdLabelFormatterTest.php index 401266ab..6ec65931 100644 --- a/tests/unit/EntityId/EntityIdLabelFormatterTest.php +++ b/tests/unit/EntityId/EntityIdLabelFormatterTest.php @@ -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' ) diff --git a/tests/unit/EntityId/EscapingEntityIdFormatterTest.php b/tests/unit/EntityId/EscapingEntityIdFormatterTest.php index 09167b77..f3e5a24d 100644 --- a/tests/unit/EntityId/EscapingEntityIdFormatterTest.php +++ b/tests/unit/EntityId/EscapingEntityIdFormatterTest.php @@ -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' ) ); diff --git a/tests/unit/EntityId/PrefixMappingEntityIdParserTest.php b/tests/unit/EntityId/PrefixMappingEntityIdParserTest.php index e072680f..7fb3efaa 100644 --- a/tests/unit/EntityId/PrefixMappingEntityIdParserTest.php +++ b/tests/unit/EntityId/PrefixMappingEntityIdParserTest.php @@ -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() ) ); diff --git a/tests/unit/Lookup/DisabledEntityTypesEntityLookupTest.php b/tests/unit/Lookup/DisabledEntityTypesEntityLookupTest.php index bd219374..8759c79a 100644 --- a/tests/unit/Lookup/DisabledEntityTypesEntityLookupTest.php +++ b/tests/unit/Lookup/DisabledEntityTypesEntityLookupTest.php @@ -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' ) diff --git a/tests/unit/Lookup/DispatchingEntityLookupTest.php b/tests/unit/Lookup/DispatchingEntityLookupTest.php index 814efc14..48f58360 100644 --- a/tests/unit/Lookup/DispatchingEntityLookupTest.php +++ b/tests/unit/Lookup/DispatchingEntityLookupTest.php @@ -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 ) ); @@ -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' ) ) ); } diff --git a/tests/unit/Lookup/EntityRetrievingClosestReferencedEntityIdLookupTest.php b/tests/unit/Lookup/EntityRetrievingClosestReferencedEntityIdLookupTest.php index c5015a54..f4d18a39 100644 --- a/tests/unit/Lookup/EntityRetrievingClosestReferencedEntityIdLookupTest.php +++ b/tests/unit/Lookup/EntityRetrievingClosestReferencedEntityIdLookupTest.php @@ -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 ) @@ -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' ) ); diff --git a/tests/unit/Lookup/InProcessCachingDataTypeLookupTest.php b/tests/unit/Lookup/InProcessCachingDataTypeLookupTest.php index 42e5816b..b53f7638 100644 --- a/tests/unit/Lookup/InProcessCachingDataTypeLookupTest.php +++ b/tests/unit/Lookup/InProcessCachingDataTypeLookupTest.php @@ -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' ) @@ -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' ) diff --git a/tests/unit/Lookup/LanguageLabelDescriptionLookupTest.php b/tests/unit/Lookup/LanguageLabelDescriptionLookupTest.php index 8dfec18c..fef82f08 100644 --- a/tests/unit/Lookup/LanguageLabelDescriptionLookupTest.php +++ b/tests/unit/Lookup/LanguageLabelDescriptionLookupTest.php @@ -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' ) @@ -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' ) @@ -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' ) @@ -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' ) diff --git a/tests/unit/Lookup/RedirectResolvingEntityLookupTest.php b/tests/unit/Lookup/RedirectResolvingEntityLookupTest.php index 9a7d329f..20bfac99 100644 --- a/tests/unit/Lookup/RedirectResolvingEntityLookupTest.php +++ b/tests/unit/Lookup/RedirectResolvingEntityLookupTest.php @@ -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' ) diff --git a/tests/unit/Lookup/RestrictedEntityLookupTest.php b/tests/unit/Lookup/RestrictedEntityLookupTest.php index 77da3cec..96ea9171 100644 --- a/tests/unit/Lookup/RestrictedEntityLookupTest.php +++ b/tests/unit/Lookup/RestrictedEntityLookupTest.php @@ -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' ) diff --git a/tests/unit/Statement/Filter/DataTypeStatementFilterTest.php b/tests/unit/Statement/Filter/DataTypeStatementFilterTest.php index 56c91189..2a1d61b3 100644 --- a/tests/unit/Statement/Filter/DataTypeStatementFilterTest.php +++ b/tests/unit/Statement/Filter/DataTypeStatementFilterTest.php @@ -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' ) diff --git a/tests/unit/Statement/Grouper/FilteringStatementGrouperTest.php b/tests/unit/Statement/Grouper/FilteringStatementGrouperTest.php index ee9c8a5f..159540f4 100644 --- a/tests/unit/Statement/Grouper/FilteringStatementGrouperTest.php +++ b/tests/unit/Statement/Grouper/FilteringStatementGrouperTest.php @@ -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' ) From f9ee1248ef45e17daffe971794fa7e291021f64b Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Tue, 7 Aug 2018 16:42:08 +0200 Subject: [PATCH 3/3] Stop supporting PHP 5.5.x --- .travis.yml | 2 ++ RELEASE-NOTES.md | 1 + composer.json | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 75d66087..916cdcff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,8 @@ matrix: include: - env: DM=~6.3 php: hhvm + - env: DM=~7.5 + php: 5.6 - env: DM=~7.5 php: 7 - env: DM=~8.0 diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 909c7cb3..613cd70c 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -4,6 +4,7 @@ * 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) diff --git a/composer.json b/composer.json index 644d1d14..6ff0b006 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "irc": "irc://irc.freenode.net/wikidata" }, "require": { - "php": ">=5.5.9", + "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",