From 1d7f09a4f7f4029292017504e6eca72f745e0827 Mon Sep 17 00:00:00 2001 From: Platonides Date: Tue, 21 Jun 2011 17:41:25 +0000 Subject: [PATCH] UploadTest::testTitleValidation accessed the database to fetch the interwikis. phase3/includes/upload/UploadBase.php:620 phase3/tests/phpunit/includes/UploadTest.php:120 phase3/tests/phpunit/includes/UploadTest.php:55 phase3/tests/phpunit/includes/UploadTest.php:35 $wgContLang not needed, TitlePermissionTest.php changes the language, inheriting from MediaWikiLangTestCase --- tests/phpunit/MediaWikiTestCase.php | 4 ++++ tests/phpunit/includes/TitlePermissionTest.php | 7 ++++++- tests/phpunit/includes/UploadTest.php | 10 ++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index a88c3572cf..64cb486b5d 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -231,5 +231,9 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { MediaWikiPHPUnitCommand::$additionalOptions[$offset] = $value; } + + public static function disableInterwikis( $prefix, &$data ) { + return false; + } } diff --git a/tests/phpunit/includes/TitlePermissionTest.php b/tests/phpunit/includes/TitlePermissionTest.php index 2b920f5e00..753709c5da 100644 --- a/tests/phpunit/includes/TitlePermissionTest.php +++ b/tests/phpunit/includes/TitlePermissionTest.php @@ -3,7 +3,7 @@ /** * @group Database */ -class TitlePermissionTest extends MediaWikiTestCase { +class TitlePermissionTest extends MediaWikiLangTestCase { protected $title; protected $user; protected $anonUser; @@ -14,6 +14,7 @@ class TitlePermissionTest extends MediaWikiTestCase { function setUp() { global $wgLocaltimezone, $wgLocalTZoffset, $wgMemc, $wgContLang, $wgLang; + parent::setUp(); if(!$wgMemc) { $wgMemc = new EmptyBagOStuff; @@ -50,6 +51,10 @@ class TitlePermissionTest extends MediaWikiTestCase { } } + function tearDown() { + parent::tearDown(); + } + function setUserPerm( $perm ) { if ( is_array( $perm ) ) { $this->user->mRights = $perm; diff --git a/tests/phpunit/includes/UploadTest.php b/tests/phpunit/includes/UploadTest.php index da19c90dbf..c9d6afaf6f 100644 --- a/tests/phpunit/includes/UploadTest.php +++ b/tests/phpunit/includes/UploadTest.php @@ -7,10 +7,16 @@ class UploadTest extends MediaWikiTestCase { function setUp() { - global $wgContLang; + global $wgHooks; parent::setUp(); - $wgContLang = Language::factory( 'en' ); + $this->upload = new UploadTestHandler; + $this->hooks = $wgHooks; + $wgHooks['InterwikiLoadPrefix'][] = 'MediaWikiTestCase::disableInterwikis'; + } + + function tearDown() { + $wgHooks = $this->hooks; } /** -- 2.20.1