From: Tim Starling Date: Tue, 4 Sep 2018 00:51:18 +0000 (+1000) Subject: Don't save and restore the interwiki table X-Git-Tag: 1.34.0-rc.0~4204^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=ef88b9aa33739fa5887e3d206077235a397a0784 Don't save and restore the interwiki table In fact it always has zero rows. Well, at least it does until ApiQuerySiteinfoTest::testInterwikiMap() inserts two rows without using @group Database, and then it has two rows from then on. It's meant to have zero rows. This saves time and memory. Revert of f17feae3a991de9f54e0f57d91fe95bf84211fcb Change-Id: Ibdb12ff941d2cb47143bdff176072ef9078fa0f7 --- diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 17147eb732..3917ca6152 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -8,7 +8,6 @@ use Psr\Log\LoggerInterface; use Wikimedia\Rdbms\IDatabase; use Wikimedia\Rdbms\IMaintainableDatabase; use Wikimedia\Rdbms\Database; -use Wikimedia\Rdbms\IResultWrapper; use Wikimedia\Rdbms\LBFactory; use Wikimedia\TestingAccessWrapper; @@ -101,12 +100,6 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { */ private $mwGlobalsToUnset = []; - /** - * Holds original contents of interwiki table - * @var IResultWrapper - */ - private $interwikiTable = null; - /** * Holds original loggers which have been replaced by setLogger() * @var LoggerInterface[] @@ -530,12 +523,6 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { } } - // Store contents of interwiki table in case it changes. Unfortunately, we seem to have no - // way to do this only when needed, because tablesUsed can be changed mid-test. - if ( $this->db ) { - $this->interwikiTable = $this->db->select( 'interwiki', '*', '', __METHOD__ ); - } - // Reset all caches between tests. $this->resetNonServiceCaches(); @@ -1763,19 +1750,6 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { // Reset the table's sequence too. $db->resetSequenceForTable( $tableName, __METHOD__ ); } - - if ( $tableName === 'interwiki' ) { - if ( !$this->interwikiTable ) { - // @todo We should probably throw here, but this causes test failures that I - // can't figure out, so for now we silently continue. - return; - } - $db->insert( - 'interwiki', - array_values( array_map( 'get_object_vars', iterator_to_array( $this->interwikiTable ) ) ), - __METHOD__ - ); - } } private static function unprefixTable( &$tableName, $ind, $prefix ) {