https://www.mediawiki.org/wiki/Special:Code/MediaWiki/105752

Revision: 105752
Author:   aaron
Date:     2011-12-10 05:47:46 +0000 (Sat, 10 Dec 2011)
Log Message:
-----------
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: trunk/phase3/tests/phpunit/MediaWikiTestCase.php
===================================================================
--- trunk/phase3/tests/phpunit/MediaWikiTestCase.php    2011-12-10 03:47:06 UTC 
(rev 105751)
+++ trunk/phase3/tests/phpunit/MediaWikiTestCase.php    2011-12-10 05:47:46 UTC 
(rev 105752)
@@ -12,8 +12,9 @@
        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 @@
                        $this->oldTablePrefix = $wgDBprefix;
 
                        if( !self::$dbSetup ) {
-                               self::$tablesCloned = $this->initDB();
+                               $this->initDB();
                                self::$dbSetup = true;
                        }
 
@@ -156,8 +157,6 @@
                if ( $this->db->getType() == 'oracle' ) {
                        $this->db->query( 'BEGIN FILL_WIKI_INFO; END;' );
                }
-
-               return $tablesCloned;
        }
 
        /**
@@ -170,13 +169,13 @@
                                        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__ );
                                }


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to