Adrian Heine has uploaded a new change for review.

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

Change subject: Make SiteLinkTableTest independent of persisted state
......................................................................

Make SiteLinkTableTest independent of persisted state

Currently, the tests depend on DB state created by order of test
case execution.

Change-Id: I472e371f2058dc7c22c63a1a4fc5e8c530ce8b87
---
M lib/tests/phpunit/store/Sql/SiteLinkTableTest.php
1 file changed, 9 insertions(+), 7 deletions(-)


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

diff --git a/lib/tests/phpunit/store/Sql/SiteLinkTableTest.php 
b/lib/tests/phpunit/store/Sql/SiteLinkTableTest.php
index 2862742..4a2dca2 100644
--- a/lib/tests/phpunit/store/Sql/SiteLinkTableTest.php
+++ b/lib/tests/phpunit/store/Sql/SiteLinkTableTest.php
@@ -34,6 +34,7 @@
                }
 
                $this->siteLinkTable = new SiteLinkTable( 'wb_items_per_site', 
false );
+               $this->tablesUsed[] = 'wb_items_per_site';
        }
 
        public function itemProvider() {
@@ -66,9 +67,10 @@
        }
 
        /**
-        * @depends testSaveLinksOfItem
+        * @dataProvider itemProvider
         */
-       public function testSaveLinksOfItem_duplicate() {
+       public function testSaveLinksOfItem_duplicate( Item $otherItem ) {
+               $this->siteLinkTable->saveLinksOfItem( $otherItem );
                $item = new Item( new ItemId( 'Q2' ) );
                $item->getSiteLinkList()->addNewSiteLink( 'enwiki', 'Beer' );
 
@@ -100,10 +102,10 @@
        }
 
        /**
-        * @depends testSaveLinksOfItem
         * @dataProvider itemProvider
         */
        public function testGetSiteLinksOfItem( Item $item ) {
+               $this->siteLinkTable->saveLinksOfItem( $item );
                $siteLinks = $this->siteLinkTable->getSiteLinksForItem( 
$item->getId() );
 
                $this->assertArrayEquals(
@@ -113,10 +115,10 @@
        }
 
        /**
-        * @depends testSaveLinksOfItem
         * @dataProvider itemProvider
         */
        public function testGetItemIdForSiteLink( Item $item ) {
+               $this->siteLinkTable->saveLinksOfItem( $item );
                foreach ( $item->getSiteLinkList()->toArray() as $siteLink ) {
                        $this->assertEquals(
                                $item->getId(),
@@ -126,10 +128,10 @@
        }
 
        /**
-        * @depends testSaveLinksOfItem
         * @dataProvider itemProvider
         */
        public function testGetItemIdForLink( Item $item ) {
+               $this->siteLinkTable->saveLinksOfItem( $item );
                foreach ( $item->getSiteLinkList()->toArray() as $siteLink ) {
                        $this->assertEquals(
                                $item->getId(),
@@ -139,10 +141,10 @@
        }
 
        /**
-        * @depends testSaveLinksOfItem
         * @dataProvider itemProvider
         */
        public function testDeleteLinksOfItem( Item $item ) {
+               $this->siteLinkTable->saveLinksOfItem( $item );
                $this->assertTrue(
                        $this->siteLinkTable->deleteLinksOfItem( $item->getId() 
) !== false
                );
@@ -153,10 +155,10 @@
        }
 
        /**
-        * @depends testSaveLinksOfItem
         * @dataProvider itemProvider
         */
        public function testClear( Item $item ) {
+               $this->siteLinkTable->saveLinksOfItem( $item );
                $this->assertTrue(
                        $this->siteLinkTable->clear() !== false
                );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I472e371f2058dc7c22c63a1a4fc5e8c530ce8b87
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Adrian Heine <adrian.l...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to