From 96a964631bd7e1229567eed3467890ce23fe8819 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 7 Jun 2018 14:36:06 +0200 Subject: [PATCH] Reset relevant DB tables before the first test of a suite. MediaWikiTestCase truncates all the tables in the tablesUsed field after each test. It should also do that before the first test of the class. Change-Id: I8c33be7b1bdd83559a9ea7803471a1f39e0eb870 --- tests/phpunit/MediaWikiTestCase.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index a27e9f9cda..4c6caa3fe6 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -402,10 +402,6 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { if ( !self::$dbSetup ) { $this->setupAllTestDBs(); $this->addCoreDBData(); - - if ( ( $this->db->getType() == 'oracle' || !self::$useTemporaryTables ) && self::$reuseDB ) { - $this->resetDB( $this->db, $this->tablesUsed ); - } } // TODO: the DB setup should be done in setUpBeforeClass(), so the test DB @@ -413,6 +409,7 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { // This would also remove the need for the HACK that is oncePerClass(). if ( $this->oncePerClass() ) { $this->setUpSchema( $this->db ); + $this->resetDB( $this->db, $this->tablesUsed ); $this->addDBDataOnce(); } -- 2.20.1