* Fixes for Parser tests (was broken with new load balancing system), added LBFactory...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 30 Mar 2008 17:43:51 +0000 (17:43 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sun, 30 Mar 2008 17:43:51 +0000 (17:43 +0000)
* Added new globals to override:
** $wgGroupPermissions : restore default value for anons, some tests don't pass if anons aren't allowed to edit (there isn't "edit section" links)
** $wgDefaultExternalStore : don't use external sotrage since there isn't a table extdb.parsertest_blobs

includes/LBFactory.php
maintenance/parserTests.inc

index e0ffbc8..6370f65 100644 (file)
@@ -18,6 +18,15 @@ abstract class LBFactory {
                return self::$instance;
        }
 
+       /**
+        * Destory the instance
+        * Actually used by maintenace/parserTests.inc to force to reopen connection
+        * when $wgDBprefix has changed
+        */
+       static function destroy(){
+               self::$instance = null;
+       }
+
        /**
         * Construct a factory based on a configuration array (typically from $wgLBFactoryConf) 
         */
index e08a5d2..0e943a0 100644 (file)
@@ -402,6 +402,14 @@ class ParserTest {
                        'wgUseTidy' => false,
                        'wgDefaultLanguageVariant' => $variant,
                        'wgVariantArticlePath' => false,
+                       'wgGroupPermissions' => array( '*' => array(
+                               'createaccount' => true,
+                               'read'          => true,
+                               'edit'          => true,
+                               'createpage'    => true,
+                               'createtalk'    => true,
+                       ) ),
+                       'wgDefaultExternalStore' => array(),
                        );
                $this->savedGlobals = array();
                foreach( $settings as $var => $val ) {
@@ -412,7 +420,6 @@ class ParserTest {
                $GLOBALS['wgLang'] = $langObj;
                $GLOBALS['wgContLang'] = $langObj;
 
-               $GLOBALS['wgLoadBalancer']->loadMasterPos();
                //$GLOBALS['wgMessageCache'] = new MessageCache( new BagOStuff(), false, 0, $GLOBALS['wgDBname'] );
                $this->setupDatabase();
 
@@ -458,7 +465,7 @@ class ParserTest {
                # Make sure we don't mess with the live DB
                if (!$setupDB && $wgDBprefix === 'parsertest_') {
                        # oh teh horror
-                       $GLOBALS['wgLoadBalancer'] = LoadBalancer::newFromParams( $GLOBALS['wgDBservers'] );
+                       LBFactory::destroy();
                        $db = wfGetDB( DB_MASTER );
 
                        $tables = $this->listTables();