jenkins-bot has submitted this change and it was merged.
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(-)
Approvals:
Daniel Kinzler: Looks good to me, approved
jenkins-bot: Verified
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: merged
Gerrit-Change-Id: I472e371f2058dc7c22c63a1a4fc5e8c530ce8b87
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Adrian Heine <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: JanZerebecki <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits