(bug 4860) Expose Title->userCan() as Hooks
[lhc/web/wiklou.git] / maintenance / parserTests.inc
index fef88e0..5bc2a00 100644 (file)
@@ -293,6 +293,7 @@ class ParserTest {
                        'wgScript' => '/index.php',
                        'wgScriptPath' => '/',
                        'wgArticlePath' => '/wiki/$1',
+                       'wgActionPaths' => array(),
                        'wgUploadPath' => 'http://example.com/images',
                        'wgUploadDirectory' => $this->uploadDir,
                        'wgStyleSheetPath' => '/skins',
@@ -300,7 +301,7 @@ class ParserTest {
                        'wgServerName' => 'Britney Spears',
                        'wgLanguageCode' => 'en',
                        'wgContLanguageCode' => 'en',
-                       'wgDBprefix' => 'parsertest',
+                       'wgDBprefix' => 'parsertest_',
                        'wgDefaultUserOptions' => array(),
 
                        'wgLang' => new LanguageUtf8(),
@@ -330,8 +331,8 @@ class ParserTest {
        # List of temporary tables to create, without prefix
        # Some of these probably aren't necessary
        function listTables() {
-               return array('user', 'page', 'revision', 'text',
-                       'pagelinks', 'imagelinks', 'categorylinks', 'templatelinks',
+               $tables = array('user', 'page', 'revision', 'text',
+                       'pagelinks', 'imagelinks', 'categorylinks', 'templatelinks', 'externallinks',
                        'site_stats', 'hitcounter',
                        'ipblocks', 'image', 'oldimage',
                        'recentchanges',
@@ -339,6 +340,16 @@ class ParserTest {
                        'interwiki', 'querycache',
                        'objectcache'
                );
+
+               // FIXME manually adding additional table for the tasks extension
+               // we probably need a better software wide system to register new
+               // tables.
+               global $wgExtensionFunctions;
+               if( in_array('wfTasksExtension' , $wgExtensionFunctions ) ) {
+                       $tables[] = 'tasks';
+               }
+
+               return $tables;
        }
 
        /**
@@ -353,7 +364,7 @@ class ParserTest {
                global $wgDBprefix;
 
                # Make sure we don't mess with the live DB
-               if (!$setupDB && $wgDBprefix === 'parsertest') {
+               if (!$setupDB && $wgDBprefix === 'parsertest_') {
                        # oh teh horror
                        $GLOBALS['wgLoadBalancer'] = LoadBalancer::newFromParams( $GLOBALS['wgDBservers'] );
                        $db =& wfGetDB( DB_MASTER );
@@ -536,9 +547,9 @@ class ParserTest {
                print $this->termColor( '1;31' ) . 'FAILED!' . $this->termReset() . "\n";
                if( $this->showDiffs ) {
                        print $this->quickDiff( $result, $html );
-               }
-               if( !$this->wellFormed( $html ) ) {
-                       print "XML error: $this->mXmlError\n";
+                       if( !$this->wellFormed( $html ) ) {
+                               print "XML error: $this->mXmlError\n";
+                       }
                }
                return false;
        }
@@ -668,26 +679,9 @@ class ParserTest {
                return $text;
        }
 
-       /**
-        * Hack up a private DOCTYPE with HTML's standard entity declarations.
-        * PHP 4 seemed to know these if you gave it an HTML doctype, but
-        * PHP 5.1 doesn't.
-        * @return string
-        * @access private
-        */
-       function hackDocType() {
-               global $wgHtmlEntities;
-               $out = "<!DOCTYPE html [\n";
-               foreach( $wgHtmlEntities as $entity => $codepoint ) {
-                       $out .= "<!ENTITY $entity \"&#$codepoint;\">";
-               }
-               $out .= "]>\n";
-               return $out;
-       }
-
        function wellFormed( $text ) {
                $html =
-                       $this->hackDocType() .
+                       Sanitizer::hackDocType() .
                        '<html>' .
                        $text .
                        '</html>';