X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2FMediaWikiTestCase.php;h=72cac05194d3b5a97f142c113bc1c33bdaca4f76;hb=5bece4a5f145f695b407c840bb6fd5496a8e19d4;hp=7e07823969c240eac86d90fa956f6adeaf31f94e;hpb=ff05579d1c7fcf9d449bdd474b48338dd58b1c5d;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index 7e07823969..72cac05194 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -104,7 +104,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { ObjectCache::$instances[CACHE_DB] = new HashBagOStuff; $needsResetDB = false; - $logName = get_class( $this ) . '::' . $this->getName( false ); if ( $this->needsDB() ) { // set up a DB connection for this test to use @@ -117,34 +116,22 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { $this->checkDbIsSupported(); if ( !self::$dbSetup ) { - wfProfileIn( $logName . ' (clone-db)' ); - // switch to a temporary clone of the database self::setupTestDB( $this->db, $this->dbPrefix() ); if ( ( $this->db->getType() == 'oracle' || !self::$useTemporaryTables ) && self::$reuseDB ) { $this->resetDB(); } - - wfProfileOut( $logName . ' (clone-db)' ); } - - wfProfileIn( $logName . ' (prepare-db)' ); $this->addCoreDBData(); $this->addDBData(); - wfProfileOut( $logName . ' (prepare-db)' ); - $needsResetDB = true; } - wfProfileIn( $logName ); parent::run( $result ); - wfProfileOut( $logName ); if ( $needsResetDB ) { - wfProfileIn( $logName . ' (reset-db)' ); $this->resetDB(); - wfProfileOut( $logName . ' (reset-db)' ); } } @@ -226,8 +213,11 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { } - protected function tearDown() { + protected function addTmpFiles( $files ) { + $this->tmpFiles = array_merge( $this->tmpFiles, (array)$files ); + } + protected function tearDown() { $this->called['tearDown'] = true; // Cleaning up temporary files foreach ( $this->tmpFiles as $fileName ) { @@ -439,7 +429,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { protected function insertPage( $pageName, $text = 'Sample page for unit test.' ) { $title = Title::newFromText( $pageName, 0 ); - $user = User::newFromName( 'WikiSysop' ); + $user = User::newFromName( 'UTSysop' ); $comment = __METHOD__ . ': Sample page for unit test.'; // Avoid memory leak...? @@ -510,7 +500,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { 'UTPageSummary', EDIT_NEW, false, - User::newFromName( 'UTSysop' ) + $user ); } } @@ -641,7 +631,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { * @param string $msg */ private function assertEmpty2( $value, $msg ) { - return $this->assertTrue( $value == '', $msg ); + $this->assertTrue( $value == '', $msg ); } private static function unprefixTable( $tableName ) { @@ -657,7 +647,7 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { /** * @since 1.18 * - * @param DataBaseBase $db + * @param DatabaseBase $db * * @return array */