From: addshore Date: Fri, 24 Aug 2018 16:18:55 +0000 (+0100) Subject: Remove unused MediaWikiTestCase::prepareConnectionForTesting X-Git-Tag: 1.34.0-rc.0~4099^2 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=46d7645db2c4eab228553a4e40f4147987861667;p=lhc%2Fweb%2Fwiklou.git Remove unused MediaWikiTestCase::prepareConnectionForTesting This method is redundant to setupDatabaseWithTestPrefix. Change-Id: Ic6baa13c51948a3ea838fe827acea58dc740bafc --- diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 34f93ad7a1..d325476f89 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -1292,52 +1292,6 @@ abstract class MediaWikiTestCase extends PHPUnit\Framework\TestCase { self::$dbSetup = false; } - /** - * Prepares the given database connection for usage in the context of usage tests. - * This sets up clones database tables and changes the table prefix as appropriate. - * If the database connection already has cloned tables, calling this method has no - * effect. The tables are not re-cloned or reset in that case. - * - * @param IMaintainableDatabase $db - */ - protected function prepareConnectionForTesting( IMaintainableDatabase $db ) { - if ( !self::$dbSetup ) { - throw new LogicException( - 'Cannot use prepareConnectionForTesting()' - . ' if the test case is not defined to use the database!' - ); - } - - if ( isset( $db->_originalTablePrefix ) ) { - // The DB connection was already prepared for testing. - return; - } - - $testPrefix = self::getTestPrefixFor( $db ); - $oldPrefix = $db->tablePrefix(); - - $tablesCloned = self::listTables( $db ); - - if ( $oldPrefix === $testPrefix ) { - // The database connection already has the test prefix, but presumably not - // the cloned tables. This is the typical case, since the LBFactory will - // have the prefix set during testing, but LoadBalancers will still return - // connections that don't have the cloned table structure. - $oldPrefix = self::$oldTablePrefix; - } - - $dbClone = new CloneDatabase( $db, $tablesCloned, $testPrefix, $oldPrefix ); - $dbClone->useTemporaryTables( self::$useTemporaryTables ); - - $db->_originalTablePrefix = $oldPrefix; - - if ( ( $db->getType() == 'oracle' || !self::$useTemporaryTables ) && self::$reuseDB ) { - throw new LogicException( 'Cannot clone database tables' ); - } else { - $dbClone->cloneTableStructure(); - } - } - /** * Setups a database with cloned tables using the given prefix. *