Jeroen De Dauw has submitted this change and it was merged.

Change subject: mock Title in InfoActionHookHandlerTest
......................................................................


mock Title in InfoActionHookHandlerTest

Change-Id: I14505de401dfcd534146d0be6a3306b18be0479b
---
M client/tests/phpunit/includes/hooks/InfoActionHookHandlerTest.php
1 file changed, 15 insertions(+), 8 deletions(-)

Approvals:
  Jeroen De Dauw: Looks good to me, approved



diff --git a/client/tests/phpunit/includes/hooks/InfoActionHookHandlerTest.php 
b/client/tests/phpunit/includes/hooks/InfoActionHookHandlerTest.php
index 23eebdc..e78909a 100644
--- a/client/tests/phpunit/includes/hooks/InfoActionHookHandlerTest.php
+++ b/client/tests/phpunit/includes/hooks/InfoActionHookHandlerTest.php
@@ -4,7 +4,6 @@
 
 use Language;
 use RequestContext;
-use Title;
 use Wikibase\Client\Hooks\InfoActionHookHandler;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\NamespaceChecker;
@@ -18,13 +17,12 @@
  *
  * @group WikibaseClient
  * @group InfoActionHookHandler
- * @group Database
  * @group Wikibase
  *
  * @licence GNU GPL v2+
  * @author Katie Filbert < [email protected] >
  */
-class InfoActionHookHandlerTest extends \MediaWikiTestCase {
+class InfoActionHookHandlerTest extends \PHPUnit_Framework_TestCase {
 
        /**
         * @dataProvider handleProvider
@@ -117,12 +115,21 @@
         * @return IContextSource
         */
        private function getContext() {
-               $title = Title::newFromText(
-                       'Cat',
-                       $this->getDefaultWikitextNS()
-               );
+               $title = $this->getMockBuilder( 'Title' )
+                       ->disableOriginalConstructor()
+                       ->getMock();
 
-               $title->resetArticleID( 538 );
+               $title->expects( $this->any() )
+                       ->method( 'exists' )
+                       ->will( $this->returnValue( true ) );
+
+               $title->expects( $this->any() )
+                       ->method( 'getNamespace' )
+                       ->will( $this->returnValue( NS_MAIN ) );
+
+               $title->expects( $this->any() )
+                       ->method( 'getFullText' )
+                       ->will( $this->returnValue( 'Cat' ) );
 
                $context = new RequestContext();
                $context->setTitle( $title );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I14505de401dfcd534146d0be6a3306b18be0479b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Aude <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to