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

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

Change subject: Make SiteLinkTable::diffSiteLinks private
......................................................................

Make SiteLinkTable::diffSiteLinks private

Follow up to Iacc9852.

Change-Id: Iac5a9944f980fa6856c8e1441fea7ed5c39c78fc
---
M lib/includes/store/sql/SiteLinkTable.php
M lib/tests/phpunit/store/Sql/SiteLinkTableTest.php
2 files changed, 10 insertions(+), 15 deletions(-)


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

diff --git a/lib/includes/store/sql/SiteLinkTable.php 
b/lib/includes/store/sql/SiteLinkTable.php
index 1dc19e7..8de084e 100644
--- a/lib/includes/store/sql/SiteLinkTable.php
+++ b/lib/includes/store/sql/SiteLinkTable.php
@@ -68,7 +68,7 @@
         *
         * @return SiteLink[]
         */
-       public function diffSiteLinks( array $siteLinks1, array $siteLinks2 ) {
+       private function diffSiteLinks( array $siteLinks1, array $siteLinks2 ) {
                return array_udiff(
                        $siteLinks1,
                        $siteLinks2,
diff --git a/lib/tests/phpunit/store/Sql/SiteLinkTableTest.php 
b/lib/tests/phpunit/store/Sql/SiteLinkTableTest.php
index 25bd099..9416de4 100644
--- a/lib/tests/phpunit/store/Sql/SiteLinkTableTest.php
+++ b/lib/tests/phpunit/store/Sql/SiteLinkTableTest.php
@@ -79,29 +79,24 @@
        public function testUpdateLinksOfItem() {
                // save initial links
                $item = new Item( new ItemId( 'Q177' ) );
-               $item->getSiteLinkList()->addNewSiteLink( 'enwiki', 'Foo' );
-               $item->getSiteLinkList()->addNewSiteLink( 'dewiki', 'Bar' );
-               $item->getSiteLinkList()->addNewSiteLink( 'svwiki', 'Börk' );
+               $siteLinks = $item->getSiteLinkList();
+               $siteLinks->addNewSiteLink( 'enwiki', 'Foo' );
+               $siteLinks->addNewSiteLink( 'dewiki', 'Bar' );
+               $siteLinks->addNewSiteLink( 'svwiki', 'Börk' );
 
                $this->siteLinkTable->saveLinksOfItem( $item );
 
                // modify links, and save again
-               $item->getSiteLinkList()->removeLinkWithSiteId( 'enwiki' );
-               $item->getSiteLinkList()->addNewSiteLink( 'enwiki', 'FooK' );
-               $item->getSiteLinkList()->removeLinkWithSiteId( 'dewiki' );
-               $item->getSiteLinkList()->addNewSiteLink( 'nlwiki', 'GrooK' );
+               $siteLinks->removeLinkWithSiteId( 'enwiki' );
+               $siteLinks->addNewSiteLink( 'enwiki', 'FooK' );
+               $siteLinks->removeLinkWithSiteId( 'dewiki' );
+               $siteLinks->addNewSiteLink( 'nlwiki', 'GrooK' );
 
                $this->siteLinkTable->saveLinksOfItem( $item );
 
                // check that the update worked correctly
                $actualLinks = $this->siteLinkTable->getSiteLinksForItem( 
$item->getId() );
-               $expectedLinks = $item->getSiteLinkList()->toArray();
-
-               $missingLinks = $this->siteLinkTable->diffSiteLinks( 
$expectedLinks, $actualLinks );
-               $extraLinks = $this->siteLinkTable->diffSiteLinks( 
$actualLinks, $expectedLinks );
-
-               $this->assertEmpty( $missingLinks, 'Missing links' );
-               $this->assertEmpty( $extraLinks, 'Extra links' );
+               $this->assertArrayEquals( $siteLinks->toArray(), $actualLinks );
        }
 
        /**

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

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