Skip to content

Commit

Permalink
Use slightly less ancient PHPUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenDeDauw committed Aug 7, 2018
1 parent 005f6ba commit 31f0c5b
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
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 31f0c5b

Please sign in to comment.