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

Change subject: Rework and clean up ChangeHandler and ChangeHandlerTest
......................................................................


Rework and clean up ChangeHandler and ChangeHandlerTest

This fixes a lot of things from Ib0085ab and lots more.

Change-Id: If6c96e0b142c47ee91aa5034afb56d79ccdf854d
---
M client/includes/Changes/ChangeHandler.php
M client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
M client/tests/phpunit/includes/Changes/ChangeRunCoalescerTest.php
3 files changed, 110 insertions(+), 142 deletions(-)

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



diff --git a/client/includes/Changes/ChangeHandler.php 
b/client/includes/Changes/ChangeHandler.php
index cb3c116..1942555 100644
--- a/client/includes/Changes/ChangeHandler.php
+++ b/client/includes/Changes/ChangeHandler.php
@@ -86,7 +86,7 @@
        /**
         * @param AffectedPagesFinder $affectedPagesFinder
         * @param TitleFactory $titleFactory
-        * @param PageUpdater $pageUpdater
+        * @param PageUpdater $updater
         * @param ChangeListTransformer $changeListTransformer
         * @param string $localSiteId
         * @param bool $injectRecentChanges
@@ -96,7 +96,7 @@
        public function __construct(
                AffectedPagesFinder $affectedPagesFinder,
                TitleFactory $titleFactory,
-               PageUpdater $pageUpdater,
+               PageUpdater $updater,
                ChangeListTransformer $changeListTransformer,
                $localSiteId,
                $injectRecentChanges = true
@@ -106,12 +106,12 @@
                }
 
                if ( !is_bool( $injectRecentChanges ) ) {
-                       throw new InvalidArgumentException( '$injectRC must be 
a bool' );
+                       throw new InvalidArgumentException( 
'$injectRecentChanges must be a bool' );
                }
 
                $this->affectedPagesFinder = $affectedPagesFinder;
                $this->titleFactory = $titleFactory;
-               $this->updater = $pageUpdater;
+               $this->updater = $updater;
                $this->changeListTransformer = $changeListTransformer;
                $this->localSiteId = $localSiteId;
                $this->injectRecentChanges = $injectRecentChanges;
@@ -162,7 +162,7 @@
 
                $changeId = $this->getChangeIdForLog( $change );
                wfDebugLog( __CLASS__, __FUNCTION__ . ": handling change 
#$changeId"
-                       . " (" . $change->getType() . ")" );
+                       . ' (' . $change->getType() . ')' );
 
                $usagesPerPage = 
$this->affectedPagesFinder->getAffectedUsagesByPage( $change );
 
@@ -173,7 +173,7 @@
                        return false;
                }
 
-               wfDebugLog( __CLASS__, __FUNCTION__ . ": updating " . count( 
$usagesPerPage )
+               wfDebugLog( __CLASS__, __FUNCTION__ . ': updating ' . count( 
$usagesPerPage )
                        . " page(s) for change #$changeId." );
 
                $actionBuckets = array();
diff --git a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php 
b/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
index e3e8265..a7b5f28 100644
--- a/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
+++ b/client/tests/phpunit/includes/Changes/ChangeHandlerTest.php
@@ -3,7 +3,6 @@
 namespace Wikibase\Client\Tests\Changes;
 
 use ArrayIterator;
-use Site;
 use Title;
 use Wikibase\Change;
 use Wikibase\Client\Changes\AffectedPagesFinder;
@@ -13,10 +12,8 @@
 use Wikibase\Client\Usage\EntityUsage;
 use Wikibase\Client\Usage\PageEntityUsages;
 use Wikibase\Client\Usage\UsageLookup;
-use Wikibase\DataModel\Entity\Entity;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
-use Wikibase\DataModel\SiteLink;
 use Wikibase\EntityChange;
 use Wikibase\Lib\Store\SiteLinkLookup;
 use Wikibase\Lib\Store\StorageException;
@@ -40,36 +37,11 @@
  */
 class ChangeHandlerTest extends \MediaWikiTestCase {
 
-       /**
-        * @var Site
-        */
-       protected $site;
-
-       protected function setUp() {
-               parent::setUp();
-
-               $this->site = new \MediaWikiSite();
-               $this->site->setGlobalId( 'enwiki' );
-               $this->site->setLanguageCode( 'en' );
-               $this->site->addNavigationId( 'en' );
-       }
-
-       private function newChangeHandler( PageUpdater $updater = null, array 
$entities = array() ) {
-               $repo = $this->getMockRepo( $entities );
-
-               $usageLookup = $this->getUsageLookup( $repo );
-               $titleFactory = $this->getTitleFactory( $entities );
-
-               $transformer = $this->getMock( 
'Wikibase\Client\Changes\ChangeListTransformer' );
-
-               $transformer->expects( $this->any() )
-                       ->method( 'transformChangeList' )
-                       ->will( $this->returnArgument( 0 ) );
-
+       private function getAffectedPagesFinder( UsageLookup $usageLookup, 
TitleFactory $titleFactory ) {
                $namespaceChecker = new NamespaceChecker( array(), array( 
NS_MAIN ) );
 
                // @todo: mock the finder directly
-               $affectedPagesFinder = new AffectedPagesFinder(
+               return new AffectedPagesFinder(
                        $usageLookup,
                        $namespaceChecker,
                        $titleFactory,
@@ -77,12 +49,33 @@
                        'en',
                        false
                );
+       }
+
+       private function getChangeListTransformer() {
+               $transformer = $this->getMock( 
'Wikibase\Client\Changes\ChangeListTransformer' );
+
+               $transformer->expects( $this->any() )
+                       ->method( 'transformChangeList' )
+                       ->will( $this->returnArgument( 0 ) );
+
+               return $transformer;
+       }
+
+       private function getChangeHandler(
+               array $pageNamesPerItemId = array(),
+               PageUpdater $updater = null
+       ) {
+               $mockRepository = $this->getMockRepository( $pageNamesPerItemId 
);
+               $usageLookup = $this->getUsageLookup( $mockRepository );
+               $titleFactory = $this->getTitleFactory( $pageNamesPerItemId );
+               $affectedPagesFinder = $this->getAffectedPagesFinder( 
$usageLookup, $titleFactory );
+               $changeListTransformer = $this->getChangeListTransformer();
 
                $handler = new ChangeHandler(
                        $affectedPagesFinder,
                        $titleFactory,
-                       $updater ? : new MockPageUpdater(),
-                       $transformer,
+                       $updater ?: new MockPageUpdater(),
+                       $changeListTransformer,
                        'enwiki',
                        true
                );
@@ -90,7 +83,7 @@
                return $handler;
        }
 
-       private function getMockRepo( array $entities = array() ) {
+       private function getMockRepository( array $pageNamesPerItemId ) {
                $repo = new MockRepository();
 
                // entity 1, revision 11
@@ -129,7 +122,7 @@
                $entity1->setDescription( 'en', 'the second' );
                $repo->putEntity( $entity1, 1211 );
 
-               $this->updateMockRepo( $repo, $entities );
+               $this->updateMockRepo( $repo, $pageNamesPerItemId );
 
                return $repo;
        }
@@ -178,7 +171,7 @@
                $handleChangeCallCount = 0;
                $handleChangesCallCount = 0;
 
-               $changeHandler = $this->newChangeHandler();
+               $changeHandler = $this->getChangeHandler();
 
                $changeHandler->handleChanges( $changes );
 
@@ -188,8 +181,6 @@
                unset( $handleChangeCallCount );
                unset( $handleChangesCallCount );
        }
-
-       // 
==========================================================================================
 
        public function provideGetUpdateActions() {
                return array(
@@ -234,7 +225,7 @@
         * @dataProvider provideGetUpdateActions
         */
        public function testGetUpdateActions( $aspects, $expected, $not = 
array() ) {
-               $handler = $this->newChangeHandler();
+               $handler = $this->getChangeHandler();
                $actions = $handler->getUpdateActions( $aspects );
 
                sort( $expected );
@@ -242,16 +233,16 @@
 
                // check that $actions contains AT LEAST $expected
                $actual = array_intersect( $actions, $expected );
-               $this->assertEquals( array_values( $expected ), array_values( 
$actual ), "expected actions" );
+               $this->assertEquals( array_values( $expected ), array_values( 
$actual ), 'expected actions' );
 
                $unexpected = array_intersect( $actions, $not );
-               $this->assertEmpty( array_values( $unexpected ), "unexpected 
actions: " . implode( '|', $unexpected ) );
+               $this->assertEmpty( array_values( $unexpected ), 'unexpected 
actions: ' . implode( '|', $unexpected ) );
        }
 
        public function provideGetEditComment() {
                $changes = TestChanges::getChanges();
 
-               $dummy = \Title::newFromText( "Dummy" );
+               $dummy = Title::newFromText( 'Dummy' );
 
                return array(
                        array( // #0
@@ -351,27 +342,26 @@
         * @example if Q100 has a link enwiki => 'Emmy',
         * then 100 => 'Emmy' will be in the map returned by this method.
         *
-        * @param array[] $entities Assoc array mapping entity IDs to lists of 
sitelinks.
-        * This is the form expected by the $entities parameter of 
testGetPagesToUpdate, etc.
+        * @param array[] $pageNamesPerItemId Assoc array mapping entity IDs to 
lists of sitelinks.
         *
         * @return string[]
         */
-       private function getFakePageIdMap( array $entities ) {
+       private function getFakePageIdMap( array $pageNamesPerItemId ) {
                $titlesByPageId = array();
-               $siteId = $this->site->getGlobalId();
+               $siteId = 'enwiki';
 
-               foreach ( $entities as $entityKey => $links ) {
-                       $id = new ItemId( $entityKey );
+               foreach ( $pageNamesPerItemId as $idString => $pageNames ) {
+                       $itemId = new ItemId( $idString );
 
                        // If $links[0] is set, it's considered a link to the 
local wiki.
                        // The index 0 is effectively an alias for $siteId;
-                       if ( isset( $links[0] ) ) {
-                               $links[$siteId] = $links[0];
+                       if ( isset( $pageNames[0] ) ) {
+                               $pageNames[$siteId] = $pageNames[0];
                        }
 
-                       if ( isset( $links[$siteId] ) ) {
-                               $pageId = $id->getNumericId();
-                               $titlesByPageId[$pageId] = $links[$siteId];
+                       if ( isset( $pageNames[$siteId] ) ) {
+                               $pageId = $itemId->getNumericId();
+                               $titlesByPageId[$pageId] = $pageNames[$siteId];
                        }
                }
 
@@ -382,13 +372,12 @@
         * Title factory, using spoofed local page ids that correspond to the 
ids of items linked to
         * the respective page (see getUsageLookup).
         *
-        * @param array[] $entities Assoc array mapping entity IDs to lists of 
sitelinks.
-        * This is the form expected by the $entities parameter of 
testGetPagesToUpdate, etc.
+        * @param array[] $pageNamesPerItemId Assoc array mapping entity IDs to 
lists of sitelinks.
         *
         * @return TitleFactory
         */
-       private function getTitleFactory( array $entities ) {
-               $titlesById = $this->getFakePageIdMap( $entities );
+       private function getTitleFactory( array $pageNamesPerItemId ) {
+               $titlesById = $this->getFakePageIdMap( $pageNamesPerItemId );
                $pageIdsByTitle = array_flip( $titlesById );
 
                $titleFactory = $this->getMock( 
'Wikibase\Client\Store\TitleFactory' );
@@ -428,18 +417,16 @@
         * Returns a usage lookup based on $siteLinklookup.
         * Local page IDs are spoofed using the numeric item ID as the local 
page ID.
         *
-        * @param SiteLinkLookup $siteLinklookup
+        * @param SiteLinkLookup $siteLinkLookup
         *
         * @return UsageLookup
         */
-       private function getUsageLookup( SiteLinkLookup $siteLinklookup ) {
-               $site = $this->site;
-
+       private function getUsageLookup( SiteLinkLookup $siteLinkLookup ) {
                $usageLookup = $this->getMock( 
'Wikibase\Client\Usage\UsageLookup' );
                $usageLookup->expects( $this->any() )
                        ->method( 'getPagesUsing' )
                        ->will( $this->returnCallback(
-                               function( $ids ) use ( $siteLinklookup, $site ) 
{
+                               function( $ids ) use ( $siteLinkLookup ) {
                                        $pages = array();
 
                                        foreach ( $ids as $id ) {
@@ -447,9 +434,9 @@
                                                        continue;
                                                }
 
-                                               $links = 
$siteLinklookup->getSiteLinksForItem( $id );
+                                               $links = 
$siteLinkLookup->getSiteLinksForItem( $id );
                                                foreach ( $links as $link ) {
-                                                       if ( $link->getSiteId() 
== $site->getGlobalId() ) {
+                                                       if ( $link->getSiteId() 
=== 'enwiki' ) {
                                                                // we use the 
numeric item id as the fake page id of the local page!
                                                                $usages = array(
                                                                        new 
EntityUsage( $id, EntityUsage::SITELINK_USAGE ),
@@ -469,8 +456,8 @@
        /**
         * @dataProvider provideGetEditComment
         */
-       public function testGetEditComment( Change $change, \Title $title, 
$entities, $expected ) {
-               $handler = $this->newChangeHandler( null, $entities );
+       public function testGetEditComment( Change $change, Title $title, array 
$pageNamesPerItemId, $expected ) {
+               $handler = $this->getChangeHandler( $pageNamesPerItemId );
                $comment = $handler->getEditComment( $change, $title );
 
                if ( is_array( $comment ) && is_array( $expected ) ) {
@@ -480,26 +467,29 @@
                }
        }
 
-       private function updateMockRepo( MockRepository $repo, $entities ) {
-               foreach ( $entities as $id => $siteLinks ) {
-                       if ( !( $siteLinks instanceof Entity ) ) {
-                               $entity = Item::newEmpty();
-                               $entity->setId( new ItemId( $id ) );
+       /**
+        * @param MockRepository $mockRepository
+        * @param array $pageNamesPerItemId Associative array of item id string 
=> either Item object
+        * or array of site id => page name.
+        */
+       private function updateMockRepo( MockRepository $mockRepository, array 
$pageNamesPerItemId ) {
+               foreach ( $pageNamesPerItemId as $idString => $pageNames ) {
+                       if ( is_array( $pageNames ) ) {
+                               $item = Item::newEmpty();
+                               $item->setId( new ItemId( $idString ) );
 
-                               foreach ( $siteLinks as $siteId => $page ) {
-                                       if ( is_int( $siteId ) ) {
-                                               $siteIdentifier = 
$this->site->getGlobalId();
-                                       } else {
-                                               $siteIdentifier = $siteId;
+                               foreach ( $pageNames as $siteId => $pageName ) {
+                                       if ( !is_string( $siteId ) ) {
+                                               $siteId = 'enwiki';
                                        }
 
-                                       $entity->addSiteLink( new SiteLink( 
$siteIdentifier, $page ) );
+                                       
$item->getSiteLinkList()->addNewSiteLink( $siteId, $pageName );
                                }
                        } else {
-                               $entity = $siteLinks;
+                               $item = $pageNames;
                        }
 
-                       $repo->putEntity( $entity );
+                       $mockRepository->putEntity( $item );
                }
        }
 
@@ -647,9 +637,9 @@
        /**
         * @dataProvider provideHandleChange
         */
-       public function testHandleChange( Change $change, $entities, array 
$expected ) {
+       public function testHandleChange( Change $change, array 
$pageNamesPerItemId, array $expected ) {
                $updater = new MockPageUpdater();
-               $handler = $this->newChangeHandler( $updater, $entities );
+               $handler = $this->getChangeHandler( $pageNamesPerItemId, 
$updater );
 
                $handler->handleChange( $change );
                $updates = $updater->getUpdates();
diff --git a/client/tests/phpunit/includes/Changes/ChangeRunCoalescerTest.php 
b/client/tests/phpunit/includes/Changes/ChangeRunCoalescerTest.php
index 3544cad..8f308b1 100644
--- a/client/tests/phpunit/includes/Changes/ChangeRunCoalescerTest.php
+++ b/client/tests/phpunit/includes/Changes/ChangeRunCoalescerTest.php
@@ -28,13 +28,12 @@
  */
 class ChangeRunCoalescerTest extends \MediaWikiTestCase {
 
-       private function newCoalescer( array $entities = array() ) {
-               $repo = $this->getMockRepo( $entities );
-
+       private function getChangeRunCoalescer() {
+               $mockRepository = $this->getMockRepository();
                $changeFactory = TestChanges::getEntityChangeFactory();
 
                $coalescer = new ChangeRunCoalescer(
-                       $repo,
+                       $mockRepository,
                        $changeFactory,
                        'enwiki'
                );
@@ -42,7 +41,7 @@
                return $coalescer;
        }
 
-       private function getMockRepo( array $entities = array() ) {
+       private function getMockRepository() {
                $repo = new MockRepository();
 
                // entity 1, revision 11
@@ -81,28 +80,7 @@
                $entity1->setDescription( 'en', 'the second' );
                $repo->putEntity( $entity1, 1211 );
 
-               $this->updateMockRepo( $repo, $entities );
-
                return $repo;
-       }
-
-       private function updateMockRepo( MockRepository $repo, $entities ) {
-               foreach ( $entities as $id => $siteLinks ) {
-                       if ( !( $siteLinks instanceof Entity ) ) {
-                               $item = Item::newEmpty();
-                               $item->setId( $id );
-
-                               foreach ( $siteLinks as $siteId => $page ) {
-                                       $siteIdentifier = $siteId;
-
-                                       
$item->getSiteLinkList()->addNewSiteLink( $siteIdentifier, $page );
-                               }
-                       } else {
-                               $item = $siteLinks;
-                       }
-
-                       $repo->putEntity( $item );
-               }
        }
 
        /**
@@ -125,7 +103,7 @@
                }
 
                if ( !isset( $values['info']['metadata']['user_text'] ) && 
isset( $values['user_id'] ) ) {
-                       $values['info']['metadata']['user_text'] = "User" . 
$values['user_id'];
+                       $values['info']['metadata']['user_text'] = 'User' . 
$values['user_id'];
                }
 
                if ( !isset( $values['info']['metadata']['parent_id'] ) && 
isset( $values['parent_id'] ) ) {
@@ -165,15 +143,15 @@
                        $message = 'change.';
                }
 
-               $this->assertEquals( get_class( $expected ), get_class( $actual 
), $message . "class" );
+               $this->assertEquals( get_class( $expected ), get_class( $actual 
), $message . 'class' );
 
-               $this->assertEquals( $expected->getObjectId(), 
$actual->getObjectId(), $message . "ObjectId" );
-               $this->assertEquals( $expected->getTime(), $actual->getTime(), 
$message . "Time" );
-               $this->assertEquals( $expected->getType(), $actual->getType(), 
$message . "Type" );
-               $this->assertEquals( $expected->getUser(), $actual->getUser(), 
$message . "User" );
+               $this->assertEquals( $expected->getObjectId(), 
$actual->getObjectId(), $message . 'ObjectId' );
+               $this->assertEquals( $expected->getTime(), $actual->getTime(), 
$message . 'Time' );
+               $this->assertEquals( $expected->getType(), $actual->getType(), 
$message . 'Type' );
+               $this->assertEquals( $expected->getUser(), $actual->getUser(), 
$message . 'User' );
 
                if ( $expected instanceof EntityChange && $actual instanceof 
EntityChange ) {
-                       $this->assertEquals( $expected->getAction(), 
$actual->getAction(), $message . "Action" );
+                       $this->assertEquals( $expected->getAction(), 
$actual->getAction(), $message . 'Action' );
                        $this->assertArrayEquals( $expected->getMetadata(), 
$actual->getMetadata(), false, true );
                }
        }
@@ -187,14 +165,14 @@
                $offset = 100 * $numericId + 1000 * $userId;
 
                // create with a label and site link set
-               $create = self::makeChange( array(
+               $create = $this->makeChange( array(
                        'id' => $offset + 1,
                        'type' => 'wikibase-item~add',
                        'time' => '20130101010101',
                        'object_id' => $prefixedId,
                        'revision_id' => $offset + 11,
                        'user_id' => $userId,
-               ), self::makeDiff( Item::ENTITY_TYPE,
+               ), $this->makeDiff( Item::ENTITY_TYPE,
                        array(),
                        array(
                                'label' => array( 'en' => 'Test' ),
@@ -203,14 +181,14 @@
                ) );
 
                // set a label
-               $update = self::makeChange( array(
+               $update = $this->makeChange( array(
                        'id' => $offset + 23,
                        'type' => 'wikibase-item~update',
                        'time' => '20130102020202',
                        'object_id' => $prefixedId,
                        'revision_id' => $offset + 12,
                        'user_id' => $userId,
-               ), self::makeDiff( Item::ENTITY_TYPE,
+               ), $this->makeDiff( Item::ENTITY_TYPE,
                        array(),
                        array(
                                'label' => array( 'de' => 'Test' ),
@@ -218,7 +196,7 @@
                ) );
 
                // merged change consisting of $create and $update
-               $create_update = self::makeChange( array(
+               $create_update = $this->makeChange( array(
                        'id' => null,
                        'type' => $create->getField('type'), // because the 
first change has no parent
                        'time' => $update->getField('time'), // last change's 
timestamp
@@ -231,7 +209,7 @@
                                        'comment' => 'wikibase-comment-add' // 
this assumes a specific 'type'
                                )
                        )
-               ), self::makeDiff( Item::ENTITY_TYPE,
+               ), $this->makeDiff( Item::ENTITY_TYPE,
                        array(),
                        array(
                                'label' => array( 'en' => 'Test', 'de' => 
'Test' ),
@@ -240,14 +218,14 @@
                ) );
 
                // change link to other wiki
-               $updateXLink = self::makeChange( array(
+               $updateXLink = $this->makeChange( array(
                        'id' => $offset + 14,
                        'type' => 'wikibase-item~update',
                        'time' => '20130101020304',
                        'object_id' => $prefixedId,
                        'revision_id' => $offset + 13,
                        'user_id' => $userId,
-               ), self::makeDiff( Item::ENTITY_TYPE,
+               ), $this->makeDiff( Item::ENTITY_TYPE,
                        array(),
                        array(
                                'links' => array( 'dewiki' => array( 'name' => 
'Testen', 'badges' => array() ) ),
@@ -255,7 +233,7 @@
                ) );
 
                // merged change consisting of $create, $update and $updateXLink
-               $create_update_link = self::makeChange( array(
+               $create_update_link = $this->makeChange( array(
                        'id' => null,
                        'type' => $create->getField('type'), // because the 
first change has no parent
                        'time' => $updateXLink->getField('time'), // last 
change's timestamp
@@ -268,7 +246,7 @@
                                        'comment' => 'wikibase-comment-add' // 
this assumes a specific 'type'
                                )
                        )
-               ), self::makeDiff( Item::ENTITY_TYPE,
+               ), $this->makeDiff( Item::ENTITY_TYPE,
                        array(),
                        array(
                                'label' => array( 'en' => 'Test', 'de' => 
'Test' ),
@@ -280,14 +258,14 @@
                ) );
 
                // some other user changed a label
-               $updateX = self::makeChange( array(
+               $updateX = $this->makeChange( array(
                        'id' => $offset + 12,
                        'type' => 'wikibase-item~update',
                        'time' => '20130103030303',
                        'object_id' => $prefixedId,
                        'revision_id' => $offset + 14,
                        'user_id' => $userId + 17,
-               ), self::makeDiff( Item::ENTITY_TYPE,
+               ), $this->makeDiff( Item::ENTITY_TYPE,
                        array(),
                        array(
                                'label' => array( 'fr' => array( 'name' => 
'Test', 'badges' => array() ) ),
@@ -295,14 +273,14 @@
                ) );
 
                // change link to local wiki
-               $updateLink = self::makeChange( array(
+               $updateLink = $this->makeChange( array(
                        'id' => $offset + 13,
                        'type' => 'wikibase-item~update',
                        'time' => '20130102030405',
                        'object_id' => $prefixedId,
                        'revision_id' => $offset + 17,
                        'user_id' => $userId,
-               ), self::makeDiff( Item::ENTITY_TYPE,
+               ), $this->makeDiff( Item::ENTITY_TYPE,
                        array(
                                'links' => array( 'enwiki' => array( 'name' => 
'Test', 'badges' => array( 'Q555' ) ) ),
                        ),
@@ -312,14 +290,14 @@
                ) );
 
                // change only badges in link to local wiki
-               $updateLinkBadges = self::makeChange( array(
+               $updateLinkBadges = $this->makeChange( array(
                        'id' => $offset + 14,
                        'type' => 'wikibase-item~update',
                        'time' => '20130102030405',
                        'object_id' => $prefixedId,
                        'revision_id' => $offset + 18,
                        'user_id' => $userId,
-               ), self::makeDiff( Item::ENTITY_TYPE,
+               ), $this->makeDiff( Item::ENTITY_TYPE,
                        array(
                                'links' => array( 'enwiki' => array( 'name' => 
'Test', 'badges' => array( 'Q555' ) ) ),
                        ),
@@ -329,14 +307,14 @@
                ) );
 
                // item deleted
-               $delete = self::makeChange( array(
+               $delete = $this->makeChange( array(
                        'id' => $offset + 35,
                        'type' => 'wikibase-item~remove',
                        'time' => '20130105050505',
                        'object_id' => $prefixedId,
                        'revision_id' => 0,
                        'user_id' => $userId,
-               ), self::makeDiff( Item::ENTITY_TYPE,
+               ), $this->makeDiff( Item::ENTITY_TYPE,
                        array(
                                'label' => array( 'en' => 'Test', 'de' => 
'Test' ),
                                'links' => array( 'enwiki' => 'Test', 'dewiki' 
=> 'Test' ),
@@ -358,7 +336,7 @@
        }
 
        public function provideCoalesceChanges() {
-               $changes11 = self::makeTestChanges( 1, 1 );
+               $changes11 = $this->makeTestChanges( 1, 1 );
 
                $create11 = $changes11['create']; // create item
                $update11 = $changes11['update']; // update item
@@ -366,7 +344,7 @@
                $create_update_link11 = 
$changes11['create+update+update-link/other']; // merged create and update and 
update link to other wiki
                $delete11 = $changes11['delete']; // delete item
 
-               $changes12 = self::makeTestChanges( 1, 2 );
+               $changes12 = $this->makeTestChanges( 1, 2 );
 
                $create12 = $changes12['create']; // create item
                $update12 = $changes12['update']; // update item
@@ -404,14 +382,14 @@
         * @dataProvider provideCoalesceChanges
         */
        public function testCoalesceChanges( $changes, $expected ) {
-               $coalescer = $this->newCoalescer();
+               $coalescer = $this->getChangeRunCoalescer();
                $coalesced = $coalescer->transformChangeList( $changes );
 
-               $this->assertEquals( count( $expected ), count( $coalesced ), 
"number of changes" );
+               $this->assertEquals( count( $expected ), count( $coalesced ), 
'number of changes' );
 
                $i = 0;
                while ( next( $coalesced ) && next( $expected ) ) {
-                       $this->assertChangeEquals( current( $expected ), 
current( $coalesced ), "expected[" . $i++ . "]" );
+                       $this->assertChangeEquals( current( $expected ), 
current( $coalesced ), 'expected[' . $i++ . ']' );
                }
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If6c96e0b142c47ee91aa5034afb56d79ccdf854d
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: JanZerebecki <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to