r105752 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105751‎ | r105752 | r105753 >
Date:05:47, 10 December 2011
Author:aaron
Status:ok
Tags:
Comment:
FU r105154: only clear tables that tests specify as written to. This reduces the obnoxious slowness that was getting in the way of FileBackend testing.

Since previously (pre-r105154) nothing was cleared, tests should still work.
Modified paths:
  • /trunk/phase3/tests/phpunit/MediaWikiTestCase.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/MediaWikiTestCase.php
@@ -12,8 +12,9 @@
1313 protected $oldTablePrefix;
1414 protected $useTemporaryTables = true;
1515 protected $reuseDB = false;
 16+ protected $tablesUsed = array(); // tables with data
 17+
1618 private static $dbSetup = false;
17 - private static $tablesCloned = array();
1819
1920 /**
2021 * Table name prefixes. Oracle likes it shorter.
@@ -55,7 +56,7 @@
5657 $this->oldTablePrefix = $wgDBprefix;
5758
5859 if( !self::$dbSetup ) {
59 - self::$tablesCloned = $this->initDB();
 60+ $this->initDB();
6061 self::$dbSetup = true;
6162 }
6263
@@ -156,8 +157,6 @@
157158 if ( $this->db->getType() == 'oracle' ) {
158159 $this->db->query( 'BEGIN FILL_WIKI_INFO; END;' );
159160 }
160 -
161 - return $tablesCloned;
162161 }
163162
164163 /**
@@ -170,13 +169,13 @@
171170 wfGetLB()->closeAll();
172171 $this->db = wfGetDB( DB_MASTER );
173172 } else {
174 - foreach( self::$tablesCloned as $tbl ) {
 173+ foreach( $this->tablesUsed as $tbl ) {
175174 if( $tbl == 'interwiki') continue;
176175 $this->db->query( 'TRUNCATE TABLE '.$this->db->tableName($tbl), __METHOD__ );
177176 }
178177 }
179178 } else {
180 - foreach( self::$tablesCloned as $tbl ) {
 179+ foreach( $this->tablesUsed as $tbl ) {
181180 if( $tbl == 'interwiki' || $tbl == 'user' ) continue;
182181 $this->db->delete( $tbl, '*', __METHOD__ );
183182 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r105753MFT r105752aaron06:03, 10 December 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r105154* Made resetDB() actually clear out the tables rather than leave the contents...aaron07:22, 5 December 2011

Status & tagging log