From: Max Semenik Date: Thu, 2 Jun 2011 17:58:34 +0000 (+0000) Subject: Don't duplicate tables starting with unittest_ which can be left if a previous run... X-Git-Tag: 1.31.0-rc.0~29766 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=7ad10e271dcfc1fa0a903700ceb0a7004c281e68;p=lhc%2Fweb%2Fwiklou.git Don't duplicate tables starting with unittest_ which can be left if a previous run ended with a fatal on SQLite --- diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 39d7d298f1..40f2d98aa7 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -188,12 +188,19 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { return substr( $tableName, strlen( $wgDBprefix ) ); } + static private function isNotUnittest( $table ) { + return strpos( $table, 'unittest_' ) !== 0; + } + protected function listTables() { global $wgDBprefix; $tables = $this->db->listTables( $wgDBprefix, __METHOD__ ); $tables = array_map( array( __CLASS__, 'unprefixTable' ), $tables ); + // Don't duplicate test tables from the previous fataled run + $tables = array_filter( $tables, array( __CLASS__, 'isNotUnittest' ) ); + if ( $this->db->getType() == 'sqlite' ) { $tables = array_flip( $tables ); // these are subtables of searchindex and don't need to be duped/dropped separately