Fix test database prefix in ParserTestTopLevelSuite
authorJakob Warkotsch <j.warkotsch@gmail.com>
Mon, 16 Jul 2018 12:52:20 +0000 (14:52 +0200)
committerJakob Warkotsch <j.warkotsch@gmail.com>
Mon, 16 Jul 2018 14:21:51 +0000 (16:21 +0200)
Similar to I3c3553f2ec6b5ca0d401712e4018c7eec4d9204d

Bug: T198943
Change-Id: I432ecfed48285978eddcbadad68108cfddf91499

tests/phpunit/suites/ParserTestTopLevelSuite.php

index fe38a98..1ea5853 100644 (file)
@@ -17,6 +17,8 @@ class ParserTestTopLevelSuite extends PHPUnit_Framework_TestSuite {
        /** @var ScopedCallback */
        private $ptTeardownScope;
 
+       private $oldTablePrefix = '';
+
        /**
         * @defgroup filtering_constants Filtering constants
         *
@@ -137,7 +139,9 @@ class ParserTestTopLevelSuite extends PHPUnit_Framework_TestSuite {
                $type = $db->getType();
                $prefix = $type === 'oracle' ?
                        MediaWikiTestCase::ORA_DB_PREFIX : MediaWikiTestCase::DB_PREFIX;
+               $this->oldTablePrefix = $db->tablePrefix();
                MediaWikiTestCase::setupTestDB( $db, $prefix );
+               CloneDatabase::changePrefix( $prefix );
                $teardown = $this->ptRunner->setDatabase( $db );
                $teardown = $this->ptRunner->setupUploads( $teardown );
                $this->ptTeardownScope = $teardown;
@@ -148,6 +152,7 @@ class ParserTestTopLevelSuite extends PHPUnit_Framework_TestSuite {
                if ( $this->ptTeardownScope ) {
                        ScopedCallback::consume( $this->ptTeardownScope );
                }
+               CloneDatabase::changePrefix( $this->oldTablePrefix );
        }
 
        /**