From bf28911864331877084f4f5fe2ba0ba7b8584cfe Mon Sep 17 00:00:00 2001 From: Pwirth Date: Mon, 6 Aug 2018 16:27:00 +0000 Subject: [PATCH] Fix reset interwiki table between tests This fixes the following SQL error, when the interwikilinks table was marked as used: Fatal error: Uncaught exception 'Wikimedia\Rdbms\DBQueryError' with message 'A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? Query: INSERT INTO `unittest_interwiki` (1,2,3) VALUES ('Array','Array','Array') Function: MediaWikiTestCase::resetDB iterator_to_array on the result of the select of the interwiki table returns an array with the first entry having the key 1. For multi insert to work, the array must start on 0. Change-Id: I3dc1be9e2f016709f451fe6e8d7cc60862c1ffea --- tests/phpunit/MediaWikiTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 366806ead9..3565311a33 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -1784,7 +1784,7 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { } $db->insert( 'interwiki', - array_map( 'get_object_vars', iterator_to_array( $this->interwikiTable ) ), + array_values( array_map( 'get_object_vars', iterator_to_array( $this->interwikiTable ) ) ), __METHOD__ ); } -- 2.20.1