From e52f4fcb2a9fb6db021f0114d3380cf503dea27a Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 10 Dec 2011 05:47:46 +0000 Subject: [PATCH] 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. --- tests/phpunit/MediaWikiTestCase.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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__ ); } -- 2.20.1