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 f17feae3a9
Change-Id: Ibdb12ff941d2cb47143bdff176072ef9078fa0f7
This commit is contained in:
parent
ecd0a5fce5
commit
ef88b9aa33
1 changed files with 0 additions and 26 deletions
|
|
@ -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 ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue