From: Antoine Musso Date: Thu, 27 Oct 2011 17:12:53 +0000 (+0000) Subject: parsertest now destroy virtual table under SQLite X-Git-Tag: 1.31.0-rc.0~26879 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/%7B%7B%20url_for%28%27vote%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=commitdiff_plain;h=0ed4c07832f272cee885bcf8730d8514819b77c5;p=lhc%2Fweb%2Fwiklou.git parsertest now destroy virtual table under SQLite Fix: Bug 29912 - Unit tests break if parsertest tables are still present The parserTest suite duplicate available tables. When using temporary table it assumed every table are temporary. Under SQLite searchindex is a virtual table and thus remained after a run of parserTests.php As a side effect, when running the PHPUnit with that remaining table, it caused a nice error: The last attempted database query was: "DELETE FROM unittest_parsertest_searchindex" from within function "MediaWikiTestCase::resetDB". Database returned error "1: SQL logic error or missing database" This patch is not needed for REL1_18 continuous integration since we never run the parserTests.php script. --- diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index 2577c261a1..1435066467 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -117,6 +117,7 @@ production. suppressed * (bug 31921) Magic words REVISIONDAY, REVISIONMONTH and REVISIONYEAR now give current values on preview +* (bug 29912) Unit tests break if parsertest tables are still present === API changes in 1.19 === * (bug 19838) siprop=interwikimap can now use the interwiki cache. diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index 2b52fb503a..694b7e20dd 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -868,6 +868,13 @@ class ParserTest { $this->databaseSetupDone = false; if ( $this->useTemporaryTables ) { + if( $this->db->getType() == 'sqlite' ) { + # Under SQLite the searchindex table is virtual and need + # to be explicitly destroyed. See bug 29912 + # See also MediaWikiTestCase::destroyDB() + wfDebug( __METHOD__ . " explicitly destroying sqlite virtual table parsertest_searchindex\n" ); + $this->db->query( "DROP TABLE `parsertest_searchindex`" ); + } # Don't need to do anything $this->teardownGlobals(); return;