Addshore has submitted this change and it was merged.

Change subject: Fixe the duplicate entry SQL errors in unit tests
......................................................................


Fixe the duplicate entry SQL errors in unit tests

Change-Id: I37ec742b4605e80653a247853fe23930d0d6a31d
---
M repo/tests/phpunit/includes/store/sql/SqlEntityInfoBuilderTest.php
1 file changed, 9 insertions(+), 1 deletion(-)

Approvals:
  WikidataJenkins: Verified
  Addshore: Looks good to me, approved



diff --git a/repo/tests/phpunit/includes/store/sql/SqlEntityInfoBuilderTest.php 
b/repo/tests/phpunit/includes/store/sql/SqlEntityInfoBuilderTest.php
index 4db598f..1057f4d 100644
--- a/repo/tests/phpunit/includes/store/sql/SqlEntityInfoBuilderTest.php
+++ b/repo/tests/phpunit/includes/store/sql/SqlEntityInfoBuilderTest.php
@@ -92,7 +92,15 @@
                $dbw = wfGetDB( DB_MASTER );
 
                foreach ( $rows as $row ) {
-                       $dbw->insert( $table, array_combine( $fields, $row ), 
__METHOD__ );
+                       $dbw->insert(
+                               $table,
+                               array_combine( $fields, $row ),
+                               __METHOD__,
+                               // Just ignore insertation errors... if similar 
data already is in the DB
+                               // it's probably good enough for the tests (as 
this is only testing for UNIQUE
+                               // fields anyway).
+                               array( 'IGNORE' )
+                       );
                }
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I37ec742b4605e80653a247853fe23930d0d6a31d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: WikidataJenkins <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to