Thiemo Mättig (WMDE) has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/336823 )
Change subject: Simplify newValidatorBuilders test setup to not use a mock ...................................................................... Simplify newValidatorBuilders test setup to not use a mock This is a direct follow up to I30aff7a. Change-Id: I63421d79a2612e72f24798dfaa1f3950d1b144a8 --- M repo/tests/phpunit/includes/WikibaseRepoTest.php 1 file changed, 3 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/23/336823/1 diff --git a/repo/tests/phpunit/includes/WikibaseRepoTest.php b/repo/tests/phpunit/includes/WikibaseRepoTest.php index 7bedb67..810b679 100644 --- a/repo/tests/phpunit/includes/WikibaseRepoTest.php +++ b/repo/tests/phpunit/includes/WikibaseRepoTest.php @@ -14,7 +14,6 @@ use DataValues\UnboundedQuantityValue; use DataValues\UnknownValue; use Deserializers\Deserializer; -use Language; use MediaWikiTestCase; use RequestContext; use Serializers\Serializer; @@ -22,7 +21,6 @@ use Wikibase\ChangeOp\ChangeOpFactoryProvider; use Wikibase\Client\WikibaseClient; use Wikibase\DataModel\DeserializerFactory; -use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\EntityIdParser; use Wikibase\DataModel\Entity\EntityIdValue; use Wikibase\DataModel\Entity\ItemId; @@ -103,28 +101,12 @@ $repo = $this->getWikibaseRepoWithClientSettings( new SettingsArray( [ 'foreignRepositories' => [ 'other' => [ - 'supportedEntityTypes' => [ 'kitten' ], + 'supportedEntityTypes' => [ 'item' ], ] ] ] ) ); - $kittenId = $this->getMockBuilder( EntityId::class ) - ->disableOriginalConstructor() - ->getMock(); - $kittenId->expects( $this->any() ) - ->method( 'getEntityType' ) - ->will( $this->returnValue( 'kitten' ) ); - $kittenId->expects( $this->any() ) - ->method( 'getSerialization' ) - ->will( $this->returnValue( 'other:K9' ) ); - $kittenId->expects( $this->any() ) - ->method( 'getLocalPart' ) - ->will( $this->returnValue( 'K9' ) ); - $kittenId->expects( $this->any() ) - ->method( 'getRepositoryName' ) - ->will( $this->returnValue( 'other' ) ); - - $value = new EntityIdValue( $kittenId ); + $value = new EntityIdValue( new ItemId( 'other:Q9' ) ); $builders = $repo->newValidatorBuilders(); $this->assertInstanceOf( ValidatorBuilders::class, $builders ); @@ -147,7 +129,7 @@ * @dataProvider urlSchemesProvider */ public function testDefaultUrlValidators( $input, $expected ) { - $validatorBuilders = $this->getWikibaseRepo()->getDefaultValidatorBuilders(); + $validatorBuilders = WikibaseRepo::getDefaultValidatorBuilders(); $urlValidator = new CompositeValidator( $validatorBuilders->buildUrlValidators() ); $result = $urlValidator->validate( new StringValue( $input ) ); $this->assertSame( $expected, $result->isValid() ); -- To view, visit https://gerrit.wikimedia.org/r/336823 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I63421d79a2612e72f24798dfaa1f3950d1b144a8 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits