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

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

Change subject: Add missing test case to EntityViewFactoryTest
......................................................................

Add missing test case to EntityViewFactoryTest

I'm also inlining the LanguageNameLookup in all cases where it's only
function 'getName' is not mocked anyway.

Change-Id: I628a82bcb542086739e3268e5f85e24fb787e076
---
M repo/tests/phpunit/includes/EntityIdHtmlLinkFormatterFactoryTest.php
M view/tests/phpunit/EntityTermsViewTest.php
M view/tests/phpunit/EntityViewFactoryTest.php
3 files changed, 24 insertions(+), 3 deletions(-)


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

diff --git 
a/repo/tests/phpunit/includes/EntityIdHtmlLinkFormatterFactoryTest.php 
b/repo/tests/phpunit/includes/EntityIdHtmlLinkFormatterFactoryTest.php
index 2fb2e61..9ef6daa 100644
--- a/repo/tests/phpunit/includes/EntityIdHtmlLinkFormatterFactoryTest.php
+++ b/repo/tests/phpunit/includes/EntityIdHtmlLinkFormatterFactoryTest.php
@@ -3,6 +3,7 @@
 namespace Wikibase\Repo\Test;
 
 use PHPUnit_Framework_TestCase;
+use Wikibase\Lib\LanguageNameLookup;
 use Wikibase\Lib\SnakFormatter;
 use Wikibase\Repo\EntityIdHtmlLinkFormatterFactory;
 
@@ -23,7 +24,7 @@
 
                return new EntityIdHtmlLinkFormatterFactory(
                        $titleLookup,
-                       $this->getMock( 'Wikibase\Lib\LanguageNameLookup' )
+                       new LanguageNameLookup()
                );
        }
 
diff --git a/view/tests/phpunit/EntityTermsViewTest.php 
b/view/tests/phpunit/EntityTermsViewTest.php
index 7fe714e..6d9f455 100644
--- a/view/tests/phpunit/EntityTermsViewTest.php
+++ b/view/tests/phpunit/EntityTermsViewTest.php
@@ -6,6 +6,7 @@
 use MediaWikiLangTestCase;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\Term\Fingerprint;
+use Wikibase\Lib\LanguageNameLookup;
 use Wikibase\View\EntityTermsView;
 use Wikibase\View\Template\TemplateFactory;
 use Wikibase\View\TextInjector;
@@ -52,7 +53,7 @@
                return new EntityTermsView(
                        $templateFactory,
                        $editSectionGenerator,
-                       $this->getMock( 'Wikibase\Lib\LanguageNameLookup' ),
+                       new LanguageNameLookup(),
                        $languageCode
                );
        }
diff --git a/view/tests/phpunit/EntityViewFactoryTest.php 
b/view/tests/phpunit/EntityViewFactoryTest.php
index b105c88..324ace4 100644
--- a/view/tests/phpunit/EntityViewFactoryTest.php
+++ b/view/tests/phpunit/EntityViewFactoryTest.php
@@ -6,9 +6,11 @@
 use PHPUnit_Framework_TestCase;
 use SiteList;
 use Wikibase\LanguageFallbackChain;
+use Wikibase\Lib\LanguageNameLookup;
 use Wikibase\Lib\SnakFormatter;
 use Wikibase\View\EntityViewFactory;
 use Wikibase\View\Template\TemplateFactory;
+use Wikibase\View\Template\TemplateRegistry;
 
 /**
  * @covers Wikibase\View\EntityViewFactory
@@ -34,6 +36,23 @@
  * @author Katie Filbert < [email protected] >
  */
 class EntityViewFactoryTest extends PHPUnit_Framework_TestCase {
+
+       public function constructorThrowsException() {
+               $idFormatterFactory = $this->getEntityIdFormatterFactory( 
SnakFormatter::FORMAT_WIKI );
+               $this->setExpectedException( 'InvalidArgumentException' );
+               return new EntityViewFactory(
+                       $idFormatterFactory,
+                       $idFormatterFactory,
+                       $this->getSnakFormatterFactory(),
+                       $this->getSiteStore(),
+                       new DataTypeFactory( array() ),
+                       new TemplateFactory( new TemplateRegistry() ),
+                       new LanguageNameLookup(),
+                       array(),
+                       array(),
+                       array()
+               );
+       }
 
        /**
         * @dataProvider newEntityViewProvider
@@ -87,7 +106,7 @@
                        $this->getSiteStore(),
                        new DataTypeFactory( array() ),
                        $templateFactory,
-                       $this->getMock( 'Wikibase\Lib\LanguageNameLookup' ),
+                       new LanguageNameLookup(),
                        array(),
                        array(),
                        array()

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I628a82bcb542086739e3268e5f85e24fb787e076
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to