From 7ad10e271dcfc1fa0a903700ceb0a7004c281e68 Mon Sep 17 00:00:00 2001 From: Max Semenik Date: Thu, 2 Jun 2011 17:58:34 +0000 Subject: [PATCH] Don't duplicate tables starting with unittest_ which can be left if a previous run ended with a fatal on SQLite --- tests/phpunit/MediaWikiTestCase.php | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- 2.20.1