Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/176915

Change subject: Avoid getDefaultInstance method name in tests
......................................................................

Avoid getDefaultInstance method name in tests

This is split from I04767f2 to make it easier to review.

Change-Id: I712432649c38e5e8cc3148e5c12001b1cf33c6ed
---
M client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
M 
client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
M client/tests/phpunit/includes/WikibaseClientTest.php
M repo/tests/phpunit/includes/WikibaseRepoTest.php
4 files changed, 102 insertions(+), 100 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/15/176915/1

diff --git 
a/client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php 
b/client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
index b8dbc26..1a4ef8d 100644
--- a/client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
+++ b/client/tests/phpunit/includes/DataAccess/PropertyIdResolverTest.php
@@ -20,14 +20,14 @@
  */
 class PropertyIdResolverTest extends \PHPUnit_Framework_TestCase {
 
-       private function getDefaultInstance() {
-               $repo = $this->newMockRepository();
-               $propertyLabelResolver = new MockPropertyLabelResolver( 'en', 
$repo );
+       private function getPropertyIdResolver() {
+               $mockRepository = $this->getMockRepository();
+               $propertyLabelResolver = new MockPropertyLabelResolver( 'en', 
$mockRepository );
 
                return new PropertyIdResolver( $propertyLabelResolver );
        }
 
-       private function newMockRepository() {
+       private function getMockRepository() {
                $propertyId = new PropertyId( 'P1337' );
 
                $property = Property::newFromType( 'string' );
@@ -43,8 +43,8 @@
        /**
         * @dataProvider resolvePropertyIdProvider
         */
-       public function testResolvePropertyId( $expected, $propertyLabelOrId ) {
-               $propertyIdResolver = $this->getDefaultInstance();
+       public function testResolvePropertyId( PropertyId $expected, 
$propertyLabelOrId ) {
+               $propertyIdResolver = $this->getPropertyIdResolver();
 
                $propertyId = $propertyIdResolver->resolvePropertyId( 
$propertyLabelOrId, 'en' );
                $this->assertEquals( $expected, $propertyId );
@@ -63,7 +63,7 @@
         * @dataProvider 
resolvePropertyIdWithInvalidInput_throwsExceptionProvider
         */
        public function testResolvePropertyIdWithInvalidInput_throwsException( 
$propertyIdOrLabel ) {
-               $propertyIdResolver = $this->getDefaultInstance();
+               $propertyIdResolver = $this->getPropertyIdResolver();
 
                $this->setExpectedException( 
'Wikibase\Lib\PropertyLabelNotResolvedException' );
 
diff --git 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
index 65ddf59..108a822 100644
--- 
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
+++ 
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/SnaksFinderTest.php
@@ -11,6 +11,7 @@
 use Wikibase\DataModel\Entity\PropertyId;
 use Wikibase\DataModel\Snak\PropertyValueSnak;
 use Wikibase\DataModel\Statement\Statement;
+use Wikibase\Lib\Store\EntityLookup;
 use Wikibase\Test\MockRepository;
 
 /**
@@ -26,16 +27,19 @@
  */
 class SnaksFinderTest extends \PHPUnit_Framework_TestCase {
 
-       private function getDefaultInstance() {
-               $repo = $this->newMockRepository();
+       private function getSnaksFinder() {
+               $entityLookup = $this->getEntityLookup();
 
-               return new SnaksFinder( $repo );
+               return new SnaksFinder( $entityLookup );
        }
 
-       private function newMockRepository() {
+       /**
+        * @return EntityLookup
+        */
+       private function getEntityLookup() {
                $propertyId = new PropertyId( 'P1337' );
 
-               $entityLookup = new MockRepository();
+               $mockRepository = new MockRepository();
 
                $statement1 = new Statement( new Claim( new PropertyValueSnak(
                        $propertyId,
@@ -67,19 +71,19 @@
                $property->setId( $propertyId );
                $property->getFingerprint()->setLabel( 'en', 'a kitten!' );
 
-               $entityLookup->putEntity( $item );
-               $entityLookup->putEntity( $property );
+               $mockRepository->putEntity( $item );
+               $mockRepository->putEntity( $property );
 
-               return $entityLookup;
+               return $mockRepository;
        }
 
        /**
         * @dataProvider findSnaksProvider
         */
-       public function testFindSnaks( $expected, ItemId $itemId, 
$propertyLabelOrId ) {
-               $snaksFinder = $this->getDefaultInstance();
+       public function testFindSnaks( array $expected, ItemId $itemId, 
PropertyId $propertyId ) {
+               $snaksFinder = $this->getSnaksFinder();
 
-               $snakList = $snaksFinder->findSnaks( $itemId, 
$propertyLabelOrId, 'en' );
+               $snakList = $snaksFinder->findSnaks( $itemId, $propertyId, 'en' 
);
                $this->assertEquals( $expected, $snakList );
        }
 
diff --git a/client/tests/phpunit/includes/WikibaseClientTest.php 
b/client/tests/phpunit/includes/WikibaseClientTest.php
index bce8664..b619c30 100644
--- a/client/tests/phpunit/includes/WikibaseClientTest.php
+++ b/client/tests/phpunit/includes/WikibaseClientTest.php
@@ -25,65 +25,65 @@
 class WikibaseClientTest extends \PHPUnit_Framework_TestCase {
 
        public function testGetDataTypeFactoryReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getDataTypeFactory();
+               $returnValue = $this->getWikibaseClient()->getDataTypeFactory();
                $this->assertInstanceOf( 'DataTypes\DataTypeFactory', 
$returnValue );
        }
 
        public function testGetEntityIdParserReturnType() {
-               $returnValue = $this->getDefaultInstance()->getEntityIdParser();
+               $returnValue = $this->getWikibaseClient()->getEntityIdParser();
                $this->assertInstanceOf( 
'Wikibase\DataModel\Entity\EntityIdParser', $returnValue );
        }
 
        public function testGetPropertyDataTypeLookupReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getPropertyDataTypeLookup();
+               $returnValue = 
$this->getWikibaseClient()->getPropertyDataTypeLookup();
                $this->assertInstanceOf( 
'Wikibase\DataModel\Entity\PropertyDataTypeLookup', $returnValue );
        }
 
        public function testGetStringNormalizerReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getStringNormalizer();
+               $returnValue = 
$this->getWikibaseClient()->getStringNormalizer();
                $this->assertInstanceOf( 'Wikibase\StringNormalizer', 
$returnValue );
        }
 
        public function testNewRepoLinkerReturnType() {
-               $returnValue = $this->getDefaultInstance()->newRepoLinker();
+               $returnValue = $this->getWikibaseClient()->newRepoLinker();
                $this->assertInstanceOf( 'Wikibase\Client\RepoLinker', 
$returnValue );
        }
 
        public function testGetLanguageFallbackChainFactoryReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getLanguageFallbackChainFactory();
+               $returnValue = 
$this->getWikibaseClient()->getLanguageFallbackChainFactory();
                $this->assertInstanceOf( 
'Wikibase\LanguageFallbackChainFactory', $returnValue );
        }
 
        public function testGetStoreReturnType() {
-               $returnValue = $this->getDefaultInstance()->getStore();
+               $returnValue = $this->getWikibaseClient()->getStore();
                $this->assertInstanceOf( 'Wikibase\ClientStore', $returnValue );
        }
 
        public function testGetContentLanguageReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getContentLanguage();
+               $returnValue = $this->getWikibaseClient()->getContentLanguage();
                $this->assertInstanceOf( 'Language', $returnValue );
        }
 
        public function testGetSettingsReturnType() {
-               $returnValue = $this->getDefaultInstance()->getSettings();
+               $returnValue = $this->getWikibaseClient()->getSettings();
                $this->assertInstanceOf( 'Wikibase\SettingsArray', $returnValue 
);
        }
 
        public function testGetSiteReturnType() {
-               $returnValue = $this->getDefaultInstance()->getSite();
+               $returnValue = $this->getWikibaseClient()->getSite();
                $this->assertInstanceOf( 'Site', $returnValue );
        }
 
        /**
         * @dataProvider getLangLinkSiteGroupProvider
         */
-       public function testGetLangLinkSiteGroup( $expected, $settings, 
$siteStore ) {
+       public function testGetLangLinkSiteGroup( $expected, SettingsArray 
$settings, SiteStore $siteStore ) {
                $client = new WikibaseClient( $settings, Language::factory( 
'en' ), $siteStore );
                $this->assertEquals( $expected, $client->getLangLinkSiteGroup() 
);
        }
 
        public function getLangLinkSiteGroupProvider() {
-               $siteStore = $this->getMockSiteStore();
+               $siteStore = $this->getSiteStore();
 
                $settings = clone 
WikibaseClient::getDefaultInstance()->getSettings();
 
@@ -113,7 +113,7 @@
        /**
         * @return SiteStore
         */
-       public function getMockSiteStore() {
+       private function getSiteStore() {
                $siteStore = new MockSiteStore();
 
                $site = MediaWikiSite::newFromGlobalId( 'enwiki' );
@@ -133,7 +133,7 @@
                $settings2->setSetting( 'siteGroup', 'wikivoyage' );
                $settings2->setSetting( 'siteGlobalID', 'enwiki' );
 
-               $siteStore = $this->getMockSiteStore();
+               $siteStore = $this->getSiteStore();
 
                return array(
                        array( 'wikipedia', $settings, $siteStore ),
@@ -142,22 +142,22 @@
        }
 
        public function testGetSnakFormatterFactoryReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getSnakFormatterFactory();
+               $returnValue = 
$this->getWikibaseClient()->getSnakFormatterFactory();
                $this->assertInstanceOf( 
'Wikibase\Lib\OutputFormatSnakFormatterFactory', $returnValue );
        }
 
        public function testGetValueFormatterFactoryReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getValueFormatterFactory();
+               $returnValue = 
$this->getWikibaseClient()->getValueFormatterFactory();
                $this->assertInstanceOf( 
'Wikibase\Lib\OutputFormatValueFormatterFactory', $returnValue );
        }
 
        public function testGetLanguageLinkBadgeDisplay() {
-               $returnValue = 
$this->getDefaultInstance()->getLanguageLinkBadgeDisplay();
+               $returnValue = 
$this->getWikibaseClient()->getLanguageLinkBadgeDisplay();
                $this->assertInstanceOf( 
'Wikibase\Client\Hooks\LanguageLinkBadgeDisplay', $returnValue );
        }
 
        public function testGetOtherProjectsSidebarGeneratorFactoryReturnType() 
{
-               $settings = $this->getDefaultInstance()->getSettings();
+               $settings = $this->getWikibaseClient()->getSettings();
 
                $otherProjectsLinks = $settings->getSetting( 
'otherProjectsLinks' );
 
@@ -165,14 +165,14 @@
 
                $this->assertInstanceOf(
                        
'Wikibase\Client\Hooks\OtherProjectsSidebarGeneratorFactory',
-                       
$this->getDefaultInstance()->getOtherProjectsSidebarGeneratorFactory()
+                       
$this->getWikibaseClient()->getOtherProjectsSidebarGeneratorFactory()
                );
 
                $settings->setSetting( 'otherProjectsLinks', 
$otherProjectsLinks );
        }
 
        public function testGetOtherProjectsSitesProvider() {
-               $returnValue = 
$this->getDefaultInstance()->getOtherProjectsSitesProvider();
+               $returnValue = 
$this->getWikibaseClient()->getOtherProjectsSitesProvider();
                $this->assertInstanceOf( 
'Wikibase\Client\OtherProjectsSitesProvider', $returnValue );
        }
 
@@ -183,7 +183,7 @@
        }
 
        public function testGetEntityContentDataCodec() {
-               $codec = 
$this->getDefaultInstance()->getEntityContentDataCodec();
+               $codec = 
$this->getWikibaseClient()->getEntityContentDataCodec();
                $this->assertInstanceOf( 
'Wikibase\Lib\Store\EntityContentDataCodec', $codec );
 
                $this->setExpectedException( 'RuntimeException' );
@@ -191,34 +191,34 @@
        }
 
        public function testGetInternalEntityDeserializer() {
-               $deserializer = 
$this->getDefaultInstance()->getInternalEntityDeserializer();
+               $deserializer = 
$this->getWikibaseClient()->getInternalEntityDeserializer();
                $this->assertInstanceOf( 'Deserializers\Deserializer', 
$deserializer );
        }
 
        public function testGetEntityChangeFactory() {
-               $factory = 
$this->getDefaultInstance()->getEntityChangeFactory();
+               $factory = $this->getWikibaseClient()->getEntityChangeFactory();
                $this->assertInstanceOf( 
'Wikibase\Lib\Changes\EntityChangeFactory', $factory );
        }
 
        public function testGetChangeHandler() {
-               $handler = $this->getDefaultInstance()->getChangeHandler();
+               $handler = $this->getWikibaseClient()->getChangeHandler();
                $this->assertInstanceOf( 
'Wikibase\Client\Changes\ChangeHandler', $handler );
        }
 
        public function testGetParserFunctionRegistrant() {
-               $registrant = 
$this->getDefaultInstance()->getParserFunctionRegistrant();
+               $registrant = 
$this->getWikibaseClient()->getParserFunctionRegistrant();
                $this->assertInstanceOf( 
'Wikibase\Client\Hooks\ParserFunctionRegistrant', $registrant );
        }
 
     public function testGetPropertyParserFunctionRunner() {
-        $runner = 
$this->getDefaultInstance()->getPropertyParserFunctionRunner();
+        $runner = 
$this->getWikibaseClient()->getPropertyParserFunctionRunner();
         $this->assertInstanceOf( 
'Wikibase\DataAccess\PropertyParserFunction\Runner', $runner );
     }
 
        /**
         * @return WikibaseClient
         */
-       private function getDefaultInstance() {
+       private function getWikibaseClient() {
                $settings = new SettingsArray( 
WikibaseClient::getDefaultInstance()->getSettings()->getArrayCopy() );
                return new WikibaseClient( $settings, Language::factory( 'en' ) 
);
        }
diff --git a/repo/tests/phpunit/includes/WikibaseRepoTest.php 
b/repo/tests/phpunit/includes/WikibaseRepoTest.php
index 3601d22..b9dc060 100644
--- a/repo/tests/phpunit/includes/WikibaseRepoTest.php
+++ b/repo/tests/phpunit/includes/WikibaseRepoTest.php
@@ -19,112 +19,112 @@
 class WikibaseRepoTest extends \MediaWikiTestCase {
 
        public function testGetDataTypeFactoryReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getDataTypeFactory();
+               $returnValue = $this->getWikibaseRepo()->getDataTypeFactory();
                $this->assertInstanceOf( 'DataTypes\DataTypeFactory', 
$returnValue );
        }
 
        public function testGetDataValueFactoryReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getDataValueFactory();
+               $returnValue = $this->getWikibaseRepo()->getDataValueFactory();
                $this->assertInstanceOf( 'DataValues\DataValueFactory', 
$returnValue );
        }
 
        public function testGetEntityContentFactoryReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getEntityContentFactory();
+               $returnValue = 
$this->getWikibaseRepo()->getEntityContentFactory();
                $this->assertInstanceOf( 
'Wikibase\Repo\Content\EntityContentFactory', $returnValue );
        }
 
        public function testGetEntityTitleLookupReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getEntityTitleLookup();
+               $returnValue = $this->getWikibaseRepo()->getEntityTitleLookup();
                $this->assertInstanceOf( 
'Wikibase\Lib\Store\EntityTitleLookup', $returnValue );
        }
 
        public function testGetEntityRevisionLookupReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getEntityRevisionLookup();
+               $returnValue = 
$this->getWikibaseRepo()->getEntityRevisionLookup();
                $this->assertInstanceOf( 
'Wikibase\Lib\Store\EntityRevisionLookup', $returnValue );
        }
 
        public function testGetEntityStoreReturnType() {
-               $returnValue = $this->getDefaultInstance()->getEntityStore();
+               $returnValue = $this->getWikibaseRepo()->getEntityStore();
                $this->assertInstanceOf( 'Wikibase\Lib\Store\EntityStore', 
$returnValue );
        }
 
        public function testGetPropertyDataTypeLookupReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getPropertyDataTypeLookup();
+               $returnValue = 
$this->getWikibaseRepo()->getPropertyDataTypeLookup();
                $this->assertInstanceOf( 
'Wikibase\DataModel\Entity\PropertyDataTypeLookup', $returnValue );
        }
 
        public function testGetStringNormalizerReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getStringNormalizer();
+               $returnValue = $this->getWikibaseRepo()->getStringNormalizer();
                $this->assertInstanceOf( 'Wikibase\StringNormalizer', 
$returnValue );
        }
 
        public function testGetEntityLookupReturnType() {
-               $returnValue = $this->getDefaultInstance()->getEntityLookup();
+               $returnValue = $this->getWikibaseRepo()->getEntityLookup();
                $this->assertInstanceOf( 'Wikibase\Lib\Store\EntityLookup', 
$returnValue );
        }
 
        public function testGetSnakConstructionServiceReturnType() {
-               $returnValue = 
$this->getDefaultInstance()->getSnakConstructionService();
+               $returnValue = 
$this->getWikibaseRepo()->getSnakConstructionService();
                $this->assertInstanceOf( 
'Wikibase\Lib\SnakConstructionService', $returnValue );
        }
 
        public function testGetEntityIdParserReturnType() {
-               $returnValue = $this->getDefaultInstance()->getEntityIdParser();
+               $returnValue = $this->getWikibaseRepo()->getEntityIdParser();
                $this->assertInstanceOf( 
'Wikibase\DataModel\Entity\EntityIdParser', $returnValue );
        }
 
        public function testGetClaimGuidParser() {
-               $returnValue = 
$this->getDefaultInstance()->getClaimGuidParser();
+               $returnValue = $this->getWikibaseRepo()->getClaimGuidParser();
                $this->assertInstanceOf( 
'Wikibase\DataModel\Claim\ClaimGuidParser', $returnValue );
        }
 
        public function testGetLanguageFallbackChainFactory() {
-               $returnValue = 
$this->getDefaultInstance()->getLanguageFallbackChainFactory();
+               $returnValue = 
$this->getWikibaseRepo()->getLanguageFallbackChainFactory();
                $this->assertInstanceOf( 
'Wikibase\LanguageFallbackChainFactory', $returnValue );
        }
 
        public function testGetClaimGuidValidator() {
-               $returnValue = 
$this->getDefaultInstance()->getClaimGuidValidator();
+               $returnValue = 
$this->getWikibaseRepo()->getClaimGuidValidator();
                $this->assertInstanceOf( 'Wikibase\Lib\ClaimGuidValidator', 
$returnValue );
        }
 
        public function testGetSettingsReturnType() {
-               $returnValue = $this->getDefaultInstance()->getSettings();
+               $returnValue = $this->getWikibaseRepo()->getSettings();
                $this->assertInstanceOf( 'Wikibase\SettingsArray', $returnValue 
);
        }
 
        public function testGetStoreReturnType() {
-               $returnValue = $this->getDefaultInstance()->getStore();
+               $returnValue = $this->getWikibaseRepo()->getStore();
                $this->assertInstanceOf( 'Wikibase\Store', $returnValue );
        }
 
        public function testGetSnakFormatterFactory() {
-               $returnValue = 
$this->getDefaultInstance()->getSnakFormatterFactory();
+               $returnValue = 
$this->getWikibaseRepo()->getSnakFormatterFactory();
                $this->assertInstanceOf( 
'Wikibase\Lib\OutputFormatSnakFormatterFactory', $returnValue );
        }
 
        public function testGetValueFormatterFactory() {
-               $returnValue = 
$this->getDefaultInstance()->getValueFormatterFactory();
+               $returnValue = 
$this->getWikibaseRepo()->getValueFormatterFactory();
                $this->assertInstanceOf( 
'Wikibase\Lib\OutputFormatValueFormatterFactory', $returnValue );
        }
 
        public function testGetSummaryFormatter() {
-               $returnValue = 
$this->getDefaultInstance()->getSummaryFormatter();
+               $returnValue = $this->getWikibaseRepo()->getSummaryFormatter();
                $this->assertInstanceOf( 'Wikibase\SummaryFormatter', 
$returnValue );
        }
 
        public function testGetChangeOpFactory() {
-               $returnValue = 
$this->getDefaultInstance()->getChangeOpFactoryProvider();
+               $returnValue = 
$this->getWikibaseRepo()->getChangeOpFactoryProvider();
                $this->assertInstanceOf( 
'Wikibase\ChangeOp\ChangeOpFactoryProvider', $returnValue );
        }
 
        public function testGetChangeNotifier() {
-               $factory = $this->getDefaultInstance()->getChangeNotifier();
+               $factory = $this->getWikibaseRepo()->getChangeNotifier();
                $this->assertInstanceOf( 
'Wikibase\Repo\Notifications\ChangeNotifier', $factory );
        }
 
        public function testGetContentModelMappings() {
-               $array = $this->getDefaultInstance()->getContentModelMappings();
+               $array = $this->getWikibaseRepo()->getContentModelMappings();
                foreach( $array as $entityType => $contentModel ) {
                        $this->assertTrue( is_scalar( $entityType ) );
                        $this->assertTrue( is_scalar( $contentModel ) );
@@ -132,104 +132,102 @@
        }
 
        public function testGetExceptionLocalizer() {
-               $localizer = 
$this->getDefaultInstance()->getExceptionLocalizer();
+               $localizer = $this->getWikibaseRepo()->getExceptionLocalizer();
                $this->assertInstanceOf( 
'Wikibase\Lib\Localizer\ExceptionLocalizer', $localizer );
        }
 
        public function testGetEntityContentDataCodec() {
-               $codec = 
$this->getDefaultInstance()->getEntityContentDataCodec();
+               $codec = $this->getWikibaseRepo()->getEntityContentDataCodec();
                $this->assertInstanceOf( 
'Wikibase\Lib\Store\EntityContentDataCodec', $codec );
        }
 
        public function testGetInternalEntitySerializer() {
-               $serializer = 
$this->getDefaultInstance()->getInternalEntitySerializer();
+               $serializer = 
$this->getWikibaseRepo()->getInternalEntitySerializer();
                $this->assertInstanceOf( 'Serializers\Serializer', $serializer 
);
        }
 
        public function testGetInternalEntityDeserializer() {
-               $deserializer = 
$this->getDefaultInstance()->getInternalEntityDeserializer();
+               $deserializer = 
$this->getWikibaseRepo()->getInternalEntityDeserializer();
                $this->assertInstanceOf( 'Deserializers\Deserializer', 
$deserializer );
        }
 
        public function testGetEntityChangeFactory() {
-               $factory = 
$this->getDefaultInstance()->getEntityChangeFactory();
+               $factory = $this->getWikibaseRepo()->getEntityChangeFactory();
                $this->assertInstanceOf( 
'Wikibase\Lib\Changes\EntityChangeFactory', $factory );
        }
 
        public function testNewItemHandler() {
-               $repo = $this->getDefaultInstance();
-               $handler = $repo->newItemHandler();
+               $handler = $this->getWikibaseRepo()->newItemHandler();
                $this->assertInstanceOf( 'Wikibase\Repo\Content\EntityHandler', 
$handler );
        }
 
        public function testNewPropertyHandler() {
-               $repo = $this->getDefaultInstance();
-               $handler = $repo->newPropertyHandler();
+               $handler = $this->getWikibaseRepo()->newPropertyHandler();
                $this->assertInstanceOf( 'Wikibase\Repo\Content\EntityHandler', 
$handler );
        }
 
        public function testNewItemHandler_noTransform() {
-               $repo = $this->getDefaultInstance();
-               $repo->getSettings()->setSetting( 
'transformLegacyFormatOnExport', false );
+               $wikibaseRepo = $this->getWikibaseRepo();
+               $wikibaseRepo->getSettings()->setSetting( 
'transformLegacyFormatOnExport', false );
 
-               $handler = $repo->newItemHandler();
+               $handler = $wikibaseRepo->newItemHandler();
                $this->assertNull( $handler->getLegacyExportFormatDetector() );
        }
 
        public function testNewPropertyHandler_noTransform() {
-               $repo = $this->getDefaultInstance();
-               $repo->getSettings()->setSetting( 
'transformLegacyFormatOnExport', false );
+               $wikibaseRepo = $this->getWikibaseRepo();
+               $wikibaseRepo->getSettings()->setSetting( 
'transformLegacyFormatOnExport', false );
 
-               $handler = $repo->newPropertyHandler();
+               $handler = $wikibaseRepo->newPropertyHandler();
                $this->assertNull( $handler->getLegacyExportFormatDetector() );
        }
 
        public function testNewItemHandler_withTransform() {
-               $repo = $this->getDefaultInstance();
-               $repo->getSettings()->setSetting( 
'transformLegacyFormatOnExport', true );
-               $repo->getSettings()->setSetting( 
'internalEntitySerializerClass', null );
+               $wikibaseRepo = $this->getWikibaseRepo();
+               $wikibaseRepo->getSettings()->setSetting( 
'transformLegacyFormatOnExport', true );
+               $wikibaseRepo->getSettings()->setSetting( 
'internalEntitySerializerClass', null );
 
-               $handler = $repo->newItemHandler();
+               $handler = $wikibaseRepo->newItemHandler();
                $this->assertNotNull( $handler->getLegacyExportFormatDetector() 
);
        }
 
        public function testNewPropertyHandler_withTransform() {
-               $repo = $this->getDefaultInstance();
-               $repo->getSettings()->setSetting( 
'transformLegacyFormatOnExport', true );
-               $repo->getSettings()->setSetting( 
'internalEntitySerializerClass', null );
+               $wikibaseRepo = $this->getWikibaseRepo();
+               $wikibaseRepo->getSettings()->setSetting( 
'transformLegacyFormatOnExport', true );
+               $wikibaseRepo->getSettings()->setSetting( 
'internalEntitySerializerClass', null );
 
-               $handler = $repo->newPropertyHandler();
+               $handler = $wikibaseRepo->newPropertyHandler();
                $this->assertNotNull( $handler->getLegacyExportFormatDetector() 
);
        }
 
        public function testNewItemHandler_badSerializerSetting() {
-               $repo = $this->getDefaultInstance();
-               $repo->getSettings()->setSetting( 
'transformLegacyFormatOnExport', true );
-               $repo->getSettings()->setSetting( 
'internalEntitySerializerClass', 
'Wikibase\Lib\Serializers\LegacyInternalEntitySerializer' );
+               $wikibaseRepo = $this->getWikibaseRepo();
+               $wikibaseRepo->getSettings()->setSetting( 
'transformLegacyFormatOnExport', true );
+               $wikibaseRepo->getSettings()->setSetting( 
'internalEntitySerializerClass', 
'Wikibase\Lib\Serializers\LegacyInternalEntitySerializer' );
 
                $this->setExpectedException( 'RuntimeException' );
-               $repo->newItemHandler();
+               $wikibaseRepo->newItemHandler();
        }
 
        public function testNewPropertyHandler_badSerializerSetting() {
-               $repo = $this->getDefaultInstance();
-               $repo->getSettings()->setSetting( 
'transformLegacyFormatOnExport', true );
-               $repo->getSettings()->setSetting( 
'internalEntitySerializerClass', 
'Wikibase\Lib\Serializers\LegacyInternalEntitySerializer' );
+               $wikibaseRepo = $this->getWikibaseRepo();
+               $wikibaseRepo->getSettings()->setSetting( 
'transformLegacyFormatOnExport', true );
+               $wikibaseRepo->getSettings()->setSetting( 
'internalEntitySerializerClass', 
'Wikibase\Lib\Serializers\LegacyInternalEntitySerializer' );
 
                $this->setExpectedException( 'RuntimeException' );
-               $repo->newPropertyHandler();
+               $wikibaseRepo->newPropertyHandler();
        }
 
        /**
         * @return WikibaseRepo
         */
-       private function getDefaultInstance() {
+       private function getWikibaseRepo() {
                $settings = new SettingsArray( 
WikibaseRepo::getDefaultInstance()->getSettings()->getArrayCopy() );
                return new WikibaseRepo( $settings );
        }
 
        public function testGetApiHelperFactory() {
-               $factory = $this->getDefaultInstance()->getApiHelperFactory();
+               $factory = $this->getWikibaseRepo()->getApiHelperFactory();
                $this->assertInstanceOf( 'Wikibase\Api\ApiHelperFactory', 
$factory );
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/176915
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I712432649c38e5e8cc3148e5c12001b1cf33c6ed
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

Reply via email to