From: Aaron Schulz Date: Sat, 10 Dec 2011 05:47:46 +0000 (+0000) Subject: FU r105154: only clear tables that tests specify as written to. This reduces the... X-Git-Tag: 1.31.0-rc.0~26104 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22sites_tous%22%29%20.%20%22?a=commitdiff_plain;h=e52f4fcb2a9fb6db021f0114d3380cf503dea27a;p=lhc%2Fweb%2Fwiklou.git 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. --- diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 7ce497a711..fdc3b9b4f2 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -12,8 +12,9 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { protected $oldTablePrefix; protected $useTemporaryTables = true; protected $reuseDB = false; + protected $tablesUsed = array(); // tables with data + private static $dbSetup = false; - private static $tablesCloned = array(); /** * Table name prefixes. Oracle likes it shorter. @@ -55,7 +56,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { $this->oldTablePrefix = $wgDBprefix; if( !self::$dbSetup ) { - self::$tablesCloned = $this->initDB(); + $this->initDB(); self::$dbSetup = true; } @@ -156,8 +157,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { if ( $this->db->getType() == 'oracle' ) { $this->db->query( 'BEGIN FILL_WIKI_INFO; END;' ); } - - return $tablesCloned; } /** @@ -170,13 +169,13 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { wfGetLB()->closeAll(); $this->db = wfGetDB( DB_MASTER ); } else { - foreach( self::$tablesCloned as $tbl ) { + foreach( $this->tablesUsed as $tbl ) { if( $tbl == 'interwiki') continue; $this->db->query( 'TRUNCATE TABLE '.$this->db->tableName($tbl), __METHOD__ ); } } } else { - foreach( self::$tablesCloned as $tbl ) { + foreach( $this->tablesUsed as $tbl ) { if( $tbl == 'interwiki' || $tbl == 'user' ) continue; $this->db->delete( $tbl, '*', __METHOD__ ); }