jenkins-bot has submitted this change and it was merged.

Change subject: Add missing tests for top level factory methods
......................................................................


Add missing tests for top level factory methods

Change-Id: I30eb2f4b196fb6128194e3613e2b8b78296547a9
---
M client/tests/phpunit/includes/WikibaseClientTest.php
M repo/tests/phpunit/includes/WikibaseRepoTest.php
2 files changed, 58 insertions(+), 4 deletions(-)

Approvals:
  Bene: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/client/tests/phpunit/includes/WikibaseClientTest.php 
b/client/tests/phpunit/includes/WikibaseClientTest.php
index 4300d53..5084269 100644
--- a/client/tests/phpunit/includes/WikibaseClientTest.php
+++ b/client/tests/phpunit/includes/WikibaseClientTest.php
@@ -35,6 +35,14 @@
                $this->assertSame( $first, $second );
        }
 
+       public function testGetDefaultSnakFormatterBuilders() {
+               $first = WikibaseClient::getDefaultSnakFormatterBuilders();
+               $this->assertInstanceOf( 
'Wikibase\Lib\WikibaseSnakFormatterBuilders', $first );
+
+               $second = WikibaseClient::getDefaultSnakFormatterBuilders();
+               $this->assertSame( $first, $second );
+       }
+
        public function testGetDataTypeFactoryReturnType() {
                $returnValue = $this->getWikibaseClient()->getDataTypeFactory();
                $this->assertInstanceOf( 'DataTypes\DataTypeFactory', 
$returnValue );
diff --git a/repo/tests/phpunit/includes/WikibaseRepoTest.php 
b/repo/tests/phpunit/includes/WikibaseRepoTest.php
index e5bfab3..c5ef8d6 100644
--- a/repo/tests/phpunit/includes/WikibaseRepoTest.php
+++ b/repo/tests/phpunit/includes/WikibaseRepoTest.php
@@ -4,6 +4,7 @@
 
 use Language;
 use MediaWikiTestCase;
+use RequestContext;
 use Wikibase\Lib\DataTypeDefinitions;
 use Wikibase\Repo\WikibaseRepo;
 use Wikibase\SettingsArray;
@@ -38,6 +39,14 @@
                $this->assertSame( $first, $second );
        }
 
+       public function testGetDefaultSnakFormatterBuilders() {
+               $first = 
$this->getWikibaseRepo()->getDefaultSnakFormatterBuilders();
+               $this->assertInstanceOf( 
'Wikibase\Lib\WikibaseSnakFormatterBuilders', $first );
+
+               $second = 
$this->getWikibaseRepo()->getDefaultSnakFormatterBuilders();
+               $this->assertSame( $first, $second );
+       }
+
        public function testGetDataTypeFactoryReturnType() {
                $returnValue = $this->getWikibaseRepo()->getDataTypeFactory();
                $this->assertInstanceOf( 'DataTypes\DataTypeFactory', 
$returnValue );
@@ -58,6 +67,11 @@
                $this->assertInstanceOf( 
'Wikibase\Repo\Content\EntityContentFactory', $returnValue );
        }
 
+       public function testGetEntityStoreWatcherReturnType() {
+               $returnValue = 
$this->getWikibaseRepo()->getEntityStoreWatcher();
+               $this->assertInstanceOf( 
'Wikibase\Lib\Store\EntityStoreWatcher', $returnValue );
+       }
+
        public function testGetEntityTitleLookupReturnType() {
                $returnValue = $this->getWikibaseRepo()->getEntityTitleLookup();
                $this->assertInstanceOf( 
'Wikibase\Lib\Store\EntityTitleLookup', $returnValue );
@@ -71,6 +85,20 @@
        public function testGetEntityRevisionLookupReturnType() {
                $returnValue = 
$this->getWikibaseRepo()->getEntityRevisionLookup();
                $this->assertInstanceOf( 
'Wikibase\Lib\Store\EntityRevisionLookup', $returnValue );
+       }
+
+       public function testNewRedirectCreationInteractorReturnType() {
+               $user = $this->getMockBuilder( 'User' )
+                       ->disableOriginalConstructor()
+                       ->getMock();
+               $context = new RequestContext();
+               $returnValue = 
$this->getWikibaseRepo()->newRedirectCreationInteractor( $user, $context );
+               $this->assertInstanceOf( 
'Wikibase\Repo\Interactors\RedirectCreationInteractor', $returnValue );
+       }
+
+       public function testNewTermSearchInteractorReturnType() {
+               $returnValue = 
$this->getWikibaseRepo()->newTermSearchInteractor( '' );
+               $this->assertInstanceOf( 
'Wikibase\Lib\Interactors\TermIndexSearchInteractor', $returnValue );
        }
 
        public function testGetEntityStoreReturnType() {
@@ -186,6 +214,26 @@
                $this->assertInstanceOf( 'Deserializers\Deserializer', 
$deserializer );
        }
 
+       public function testGetInternalStatementSerializer() {
+               $serializer = 
$this->getWikibaseRepo()->getInternalStatementSerializer();
+               $this->assertInstanceOf( 'Serializers\Serializer', $serializer 
);
+       }
+
+       public function testGetEntityDeserializer() {
+               $deserializer = 
$this->getWikibaseRepo()->getEntityDeserializer();
+               $this->assertInstanceOf( 'Deserializers\Deserializer', 
$deserializer );
+       }
+
+       public function testGetStatementDeserializer() {
+               $deserializer = 
$this->getWikibaseRepo()->getStatementDeserializer();
+               $this->assertInstanceOf( 'Deserializers\Deserializer', 
$deserializer );
+       }
+
+       public function testGetInternalStatementDeserializer() {
+               $deserializer = 
$this->getWikibaseRepo()->getInternalStatementDeserializer();
+               $this->assertInstanceOf( 'Deserializers\Deserializer', 
$deserializer );
+       }
+
        public function testGetEntityChangeFactory() {
                $factory = $this->getWikibaseRepo()->getEntityChangeFactory();
                $this->assertInstanceOf( 
'Wikibase\Lib\Changes\EntityChangeFactory', $factory );
@@ -243,14 +291,12 @@
        }
 
        public function testGetApiHelperFactory() {
-               $mockContext = $this->getMock( 'RequestContext' );
-               $factory = $this->getWikibaseRepo()->getApiHelperFactory( 
$mockContext );
+               $factory = $this->getWikibaseRepo()->getApiHelperFactory( new 
RequestContext() );
                $this->assertInstanceOf( 'Wikibase\Repo\Api\ApiHelperFactory', 
$factory );
        }
 
        public function testNewEditEntityFactory() {
-               $mockContext = $this->getMock( 'RequestContext' );
-               $factory = $this->getWikibaseRepo()->newEditEntityFactory( 
$mockContext );
+               $factory = $this->getWikibaseRepo()->newEditEntityFactory( new 
RequestContext() );
                $this->assertInstanceOf( 'Wikibase\EditEntityFactory', $factory 
);
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I30eb2f4b196fb6128194e3613e2b8b78296547a9
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>
Gerrit-Reviewer: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Bene <benestar.wikime...@gmail.com>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Hoo man <h...@online.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to