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

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

Change subject: Move all client tests to Wikibase\Client\Tests
......................................................................

Move all client tests to Wikibase\Client\Tests

Change-Id: If6c96e0b142c47ee91aa5034afb56d79ccdf854d
---
M client/includes/Changes/ChangeHandler.php
M client/includes/Changes/PageUpdater.php
M client/includes/Changes/WikiPageUpdater.php
M client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php
M client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
M client/tests/phpunit/includes/InterwikiSorterTest.php
M client/tests/phpunit/includes/LangLinkHandlerTest.php
M client/tests/phpunit/includes/NamespaceCheckerTest.php
M client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php
M client/tests/phpunit/includes/RepoItemLinkGeneratorTest.php
M client/tests/phpunit/includes/RepoLinkerTest.php
M client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php
M client/tests/phpunit/includes/UpdateRepoOnMoveTest.php
M client/tests/phpunit/includes/WikibaseClientTest.php
14 files changed, 47 insertions(+), 36 deletions(-)


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

diff --git a/client/includes/Changes/ChangeHandler.php 
b/client/includes/Changes/ChangeHandler.php
index 5ff4576..6b11c1b 100644
--- a/client/includes/Changes/ChangeHandler.php
+++ b/client/includes/Changes/ChangeHandler.php
@@ -2,12 +2,11 @@
 
 namespace Wikibase\Client\Changes;
 
+use Exception;
 use InvalidArgumentException;
 use MWException;
 use Title;
 use Wikibase\Change;
-use Wikibase\Client\Changes\AffectedPagesFinder;
-use Wikibase\Client\Changes\PageUpdater;
 use Wikibase\DataModel\Entity\Diff\EntityDiff;
 use Wikibase\DataModel\Entity\Diff\ItemDiff;
 use Wikibase\EntityChange;
@@ -310,7 +309,7 @@
 
                                $currentRun[] = $change;
                        // skip any change that failed to process in some way 
(bug 49417)
-                       } catch ( \Exception $e ) {
+                       } catch ( Exception $e ) {
                                wfLogWarning( __METHOD__ . ':' . 
$e->getMessage() );
                        }
                }
@@ -349,7 +348,7 @@
                        $coalesced = array_merge( $coalesced, $entityChanges );
                }
 
-               usort( $coalesced, 
'Wikibase\Client\Changes\ChangeHandler::compareChangesByTimestamp' );
+               usort( $coalesced, array( $this, 'compareChangesByTimestamp' ) 
);
 
                wfDebugLog( __CLASS__, __METHOD__ . ": coalesced "
                        . count( $changes ) . " into " . count( $coalesced ) . 
" changes"  );
@@ -364,9 +363,9 @@
         * @param Change $a
         * @param Change $b
         *
-        * @return Mixed
+        * @return int
         */
-       public static function compareChangesByTimestamp( Change $a, Change $b 
) {
+       public function compareChangesByTimestamp( Change $a, Change $b ) {
                //NOTE: beware https://bugs.php.net/bug.php?id=50688 !
 
                if ( $a->getTime() > $b->getTime() ) {
@@ -552,7 +551,7 @@
         *
         * @since 0.4
         *
-        * @param \Wikibase\EntityChange $change The Change that caused the 
update
+        * @param EntityChange $change The Change that caused the update
         *
         * @return array|boolean an array of RC attributes,
         *         or false if the change does not provide edit meta data
@@ -644,7 +643,7 @@
         *
         * @param EntityChange $change the change to get a comment for
         *
-        * @throws \MWException
+        * @throws MWException
         * @return array
         */
        public function getEditComment( EntityChange $change ) {
@@ -659,7 +658,7 @@
 
                $editComment = $commentCreator->getEditComment( $siteLinkDiff, 
$action, $comment );
                if( is_array( $editComment ) && !isset( $editComment['message'] 
) ) {
-                       throw new \MWException( 'getEditComment returned an 
empty comment' );
+                       throw new MWException( 'getEditComment returned an 
empty comment' );
                }
 
                return $editComment;
diff --git a/client/includes/Changes/PageUpdater.php 
b/client/includes/Changes/PageUpdater.php
index 5246cce..d7cf15f 100644
--- a/client/includes/Changes/PageUpdater.php
+++ b/client/includes/Changes/PageUpdater.php
@@ -2,6 +2,8 @@
 
 namespace Wikibase\Client\Changes;
 
+use Title;
+
 /**
  * Service interface for triggering different kinds of page updates
  * and generally notifying the local wiki of external changes.
@@ -21,7 +23,7 @@
         *
         * @since    0.4
         *
-        * @param \Title[] $titles The Titles of the pages to update
+        * @param Title[] $titles The Titles of the pages to update
         */
        public function purgeParserCache( array $titles );
 
@@ -30,7 +32,7 @@
         *
         * @since    0.4
         *
-        * @param \Title[] $titles The Titles of the pages to update
+        * @param Title[] $titles The Titles of the pages to update
         */
        public function purgeWebCache( array $titles );
 
@@ -39,17 +41,18 @@
         *
         * @since    0.4
         *
-        * @param \Title[] $titles The Titles of the pages to update
+        * @param Title[] $titles The Titles of the pages to update
         */
        public function scheduleRefreshLinks( array $titles );
 
        /**
         * Injects an RC entry into the recentchanges, using the the given 
title and attribs
         *
-        * @param \Title $title
+        * @param Title $title
         * @param array $attribs
         *
         * @return bool
         */
-       public function injectRCRecord( \Title $title, array $attribs );
-}
\ No newline at end of file
+       public function injectRCRecord( Title $title, array $attribs );
+
+}
diff --git a/client/includes/Changes/WikiPageUpdater.php 
b/client/includes/Changes/WikiPageUpdater.php
index 17efb69..8653894 100644
--- a/client/includes/Changes/WikiPageUpdater.php
+++ b/client/includes/Changes/WikiPageUpdater.php
@@ -107,4 +107,5 @@
                wfProfileOut( __METHOD__ );
                return true;
        }
+
 }
diff --git a/client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php 
b/client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php
index e28d88a..20b829c 100644
--- a/client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php
+++ b/client/tests/phpunit/includes/Changes/AffectedPagesFinderTest.php
@@ -4,13 +4,13 @@
 
 use ArrayIterator;
 use Title;
+use Wikibase\Client\Changes\AffectedPagesFinder;
 use Wikibase\Client\Store\TitleFactory;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\SiteLink;
 use Wikibase\ItemChange;
 use Wikibase\Lib\Store\StorageException;
-use Wikibase\Client\Changes\AffectedPagesFinder;
 use Wikibase\Test\TestChanges;
 
 /**
@@ -70,7 +70,7 @@
                        ->method( 'getPagesUsing' )
                        ->will( $this->returnValue( new ArrayIterator( $usage ) 
) );
 
-               $namespaceChecker = $this->getMockBuilder( 
'\Wikibase\NamespaceChecker' )
+               $namespaceChecker = $this->getMockBuilder( 
'Wikibase\NamespaceChecker' )
                                                        
->disableOriginalConstructor()->getMock();
 
                $namespaceChecker->expects( $this->any() )
diff --git a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php 
b/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
index ca77828..633c20b 100644
--- a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
+++ b/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
@@ -4,13 +4,16 @@
 
 use ArrayIterator;
 use Diff\Differ\MapDiffer;
+use MediaWikiSite;
+use MWException;
 use Site;
 use SiteList;
 use Title;
 use Wikibase\Change;
-use Wikibase\Client\Changes\ChangeHandler;
 use Wikibase\ChangesTable;
 use Wikibase\Client\Changes\AffectedPagesFinder;
+use Wikibase\Client\Changes\ChangeHandler;
+use Wikibase\Client\Changes\PageUpdater;
 use Wikibase\Client\Store\TitleFactory;
 use Wikibase\Client\Usage\UsageLookup;
 use Wikibase\Client\WikibaseClient;
@@ -23,8 +26,6 @@
 use Wikibase\Lib\Store\SiteLinkLookup;
 use Wikibase\Lib\Store\StorageException;
 use Wikibase\NamespaceChecker;
-use Wikibase\Client\Changes\PageUpdater;
-use Wikibase\Client\Tests\Changes\MockPageUpdater;
 use Wikibase\Test\MockRepository;
 use Wikibase\Test\TestChanges;
 
@@ -50,7 +51,7 @@
        public function setUp() {
                parent::setUp();
 
-               $this->site = new \MediaWikiSite();
+               $this->site = new MediaWikiSite();
                $this->site->setGlobalId( 'enwiki' );
                $this->site->setLanguageCode( 'en' );
                $this->site->addNavigationId( 'en' );
@@ -421,7 +422,7 @@
                        } else {
                                $this->assertChangeEquals( $expected, $merged );
                        }
-               } catch ( \MWException $ex ) {
+               } catch ( MWException $ex ) {
                        if ( !$error ) {
                                throw $ex;
                        }
@@ -885,7 +886,7 @@
        public static function provideGetEditComment() {
                $changes = TestChanges::getChanges();
 
-               $dummy = \Title::newFromText( "Dummy" );
+               $dummy = Title::newFromText( "Dummy" );
 
                return array(
                        array( // #0
@@ -1093,7 +1094,7 @@
                $siteList->expects( $this->any() )
                        ->method( 'getSite' )
                        ->will( $this->returnCallback( function( $globalSiteId 
) {
-                               $site = new \MediaWikiSite();
+                               $site = new MediaWikiSite();
 
                                $site->setGlobalId( $globalSiteId );
                                $site->setLanguageCode( substr( $globalSiteId, 
0, 2 ) );
@@ -1107,7 +1108,7 @@
        /**
         * @dataProvider provideGetEditComment
         */
-       public function testGetEditComment( Change $change, \Title $title, 
$entities, $expected ) {
+       public function testGetEditComment( Change $change, Title $title, 
$entities, $expected ) {
                $handler = $this->newChangeHandler( null, $entities );
                $comment = $handler->getEditComment( $change, $title );
 
diff --git a/client/tests/phpunit/includes/InterwikiSorterTest.php 
b/client/tests/phpunit/includes/InterwikiSorterTest.php
index 71f26dc..25081ec 100644
--- a/client/tests/phpunit/includes/InterwikiSorterTest.php
+++ b/client/tests/phpunit/includes/InterwikiSorterTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests;
 
 use Wikibase\InterwikiSorter;
 
diff --git a/client/tests/phpunit/includes/LangLinkHandlerTest.php 
b/client/tests/phpunit/includes/LangLinkHandlerTest.php
index 2550958..37492df 100644
--- a/client/tests/phpunit/includes/LangLinkHandlerTest.php
+++ b/client/tests/phpunit/includes/LangLinkHandlerTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests;
 
 use MediaWikiSite;
 use ParserOutput;
@@ -8,13 +8,15 @@
 use Wikibase\Client\Hooks\LanguageLinkBadgeDisplay;
 use Wikibase\Client\Hooks\OtherProjectsSidebarGenerator;
 use Wikibase\Client\Usage\EntityUsage;
+use Wikibase\Client\Usage\ParserOutputUsageAccumulator;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\SiteLink;
 use Wikibase\LangLinkHandler;
 use Wikibase\NamespaceChecker;
 use Wikibase\NoLangLinkHandler;
-use Wikibase\Client\Usage\ParserOutputUsageAccumulator;
+use Wikibase\Test\MockRepository;
+use Wikibase\Test\MockSiteStore;
 
 /**
  * @covers Wikibase\LangLinkHandler
diff --git a/client/tests/phpunit/includes/NamespaceCheckerTest.php 
b/client/tests/phpunit/includes/NamespaceCheckerTest.php
index d9d136a..7c0b573 100644
--- a/client/tests/phpunit/includes/NamespaceCheckerTest.php
+++ b/client/tests/phpunit/includes/NamespaceCheckerTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests;
 
 use MWNamespace;
 use Wikibase\NamespaceChecker;
@@ -103,4 +103,5 @@
                $result = $namespaceChecker->getWikibaseNamespaces();
                $this->assertArrayEquals( $expected, $result );
        }
+
 }
diff --git a/client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php 
b/client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php
index 79bdaef..5cbe92c 100644
--- a/client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php
+++ b/client/tests/phpunit/includes/OtherProjectsSitesProviderTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Wikibase\Client\Test;
+namespace Wikibase\Client\Tests;
 
 use MediaWikiSite;
 use Site;
@@ -172,4 +172,5 @@
 
                return new MockSiteStore( $sites );
        }
-}
\ No newline at end of file
+
+}
diff --git a/client/tests/phpunit/includes/RepoItemLinkGeneratorTest.php 
b/client/tests/phpunit/includes/RepoItemLinkGeneratorTest.php
index d239850..d65db2e 100644
--- a/client/tests/phpunit/includes/RepoItemLinkGeneratorTest.php
+++ b/client/tests/phpunit/includes/RepoItemLinkGeneratorTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests;
 
 use Language;
 use Title;
diff --git a/client/tests/phpunit/includes/RepoLinkerTest.php 
b/client/tests/phpunit/includes/RepoLinkerTest.php
index d23f5dd..a54a6b9 100644
--- a/client/tests/phpunit/includes/RepoLinkerTest.php
+++ b/client/tests/phpunit/includes/RepoLinkerTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests;
 
 use Wikibase\Client\RepoLinker;
 use Wikibase\DataModel\Entity\EntityId;
diff --git a/client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php 
b/client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php
index 4835540..41de08e 100644
--- a/client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php
+++ b/client/tests/phpunit/includes/SiteLinkCommentCreatorTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests;
 
 use Diff\DiffOp\Diff\Diff;
 use Diff\DiffOp\DiffOpChange;
@@ -9,6 +9,7 @@
 use Wikibase\DataModel\SiteLink;
 use Wikibase\ItemChange;
 use Wikibase\SiteLinkCommentCreator;
+use Wikibase\Test\TestChanges;
 
 /**
  * @covers Wikibase\SiteLinkCommentCreator
diff --git a/client/tests/phpunit/includes/UpdateRepoOnMoveTest.php 
b/client/tests/phpunit/includes/UpdateRepoOnMoveTest.php
index a02d2b2..ed82e2d 100644
--- a/client/tests/phpunit/includes/UpdateRepoOnMoveTest.php
+++ b/client/tests/phpunit/includes/UpdateRepoOnMoveTest.php
@@ -1,6 +1,6 @@
 <?php
 
-namespace Wikibase\Test;
+namespace Wikibase\Client\Tests;
 
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\UpdateRepoOnMove;
@@ -122,4 +122,5 @@
 
                $updateRepo->injectJob( $jobQueueGroupMock );
        }
+
 }
diff --git a/client/tests/phpunit/includes/WikibaseClientTest.php 
b/client/tests/phpunit/includes/WikibaseClientTest.php
index 03b378a..3de8022 100644
--- a/client/tests/phpunit/includes/WikibaseClientTest.php
+++ b/client/tests/phpunit/includes/WikibaseClientTest.php
@@ -1,11 +1,12 @@
 <?php
 
-namespace Wikibase\Client;
+namespace Wikibase\Client\Tests;
 
 use Language;
 use MediaWikiSite;
 use SiteStore;
 use ValueFormatters\FormatterOptions;
+use Wikibase\Client\WikibaseClient;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\Lib\SnakFormatter;
 use Wikibase\SettingsArray;

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

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