From 31f0c5b12944851cda0aca3becc1768400be2514 Mon Sep 17 00:00:00 2001 From: Jeroen De Dauw Date: Tue, 7 Aug 2018 16:36:44 +0200 Subject: [PATCH] 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' )