http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90538

Revision: 90538
Author:   platonides
Date:     2011-06-21 17:41:25 +0000 (Tue, 21 Jun 2011)
Log Message:
-----------
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

Modified Paths:
--------------
    trunk/phase3/tests/phpunit/MediaWikiTestCase.php
    trunk/phase3/tests/phpunit/includes/TitlePermissionTest.php
    trunk/phase3/tests/phpunit/includes/UploadTest.php

Modified: trunk/phase3/tests/phpunit/MediaWikiTestCase.php
===================================================================
--- trunk/phase3/tests/phpunit/MediaWikiTestCase.php    2011-06-21 17:01:03 UTC 
(rev 90537)
+++ trunk/phase3/tests/phpunit/MediaWikiTestCase.php    2011-06-21 17:41:25 UTC 
(rev 90538)
@@ -231,5 +231,9 @@
                MediaWikiPHPUnitCommand::$additionalOptions[$offset] = $value;
 
        }
+
+       public static function disableInterwikis( $prefix, &$data ) {
+               return false;
+       }
 }
 

Modified: trunk/phase3/tests/phpunit/includes/TitlePermissionTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/TitlePermissionTest.php 2011-06-21 
17:01:03 UTC (rev 90537)
+++ trunk/phase3/tests/phpunit/includes/TitlePermissionTest.php 2011-06-21 
17:41:25 UTC (rev 90538)
@@ -3,7 +3,7 @@
 /**
  * @group Database
  */
-class TitlePermissionTest extends MediaWikiTestCase {
+class TitlePermissionTest extends MediaWikiLangTestCase {
        protected $title;
        protected $user;
        protected $anonUser;
@@ -14,6 +14,7 @@
 
        function setUp() {
                global $wgLocaltimezone, $wgLocalTZoffset, $wgMemc, 
$wgContLang, $wgLang;
+               parent::setUp();
 
                if(!$wgMemc) {
                        $wgMemc = new EmptyBagOStuff;
@@ -50,6 +51,10 @@
                }
        }
 
+       function tearDown() {
+               parent::tearDown();
+       }
+
        function setUserPerm( $perm ) {
                if ( is_array( $perm ) ) {
                        $this->user->mRights = $perm;

Modified: trunk/phase3/tests/phpunit/includes/UploadTest.php
===================================================================
--- trunk/phase3/tests/phpunit/includes/UploadTest.php  2011-06-21 17:01:03 UTC 
(rev 90537)
+++ trunk/phase3/tests/phpunit/includes/UploadTest.php  2011-06-21 17:41:25 UTC 
(rev 90538)
@@ -7,12 +7,18 @@
 
 
        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;
+       }
+
        /**
         * Test various forms of valid and invalid titles that can be supplied.
         */


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to