Reset the cache used in User::idFromName(), otherwise tests will try to add the user...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Tue, 25 Jan 2011 16:32:43 +0000 (16:32 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Tue, 25 Jan 2011 16:32:43 +0000 (16:32 +0000)
includes/User.php
tests/phpunit/MediaWikiTestCase.php

index 0b4cf36..9cd33f9 100644 (file)
@@ -441,6 +441,13 @@ class User {
                return $result;
        }
 
+       /**
+        * Reset the cache used in idFromName(). For use in tests.
+        */
+       public static function resetIdByNameCache() {
+               self::$idCacheByName = array();
+       }
+
        /**
         * Does the string match an anonymous IPv4 address?
         *
index 4cd9c81..48b6212 100644 (file)
@@ -81,7 +81,9 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
        function addDBData() {}
        
        private function addCoreDBData() {
-               
+
+               User::resetIdByNameCache();
+
                //Make sysop user
                $user = User::newFromName( 'UTSysop' );