* Adding a space to the sh name so that it breaks across lines
[lhc/web/wiklou.git] / maintenance / parserTests.inc
index 0d797b2..8197a76 100644 (file)
@@ -32,6 +32,8 @@ require_once( 'commandLine.inc' );
 require_once( "$IP/includes/ObjectCache.php" );
 require_once( "$IP/includes/BagOStuff.php" );
 require_once( "$IP/languages/LanguageUtf8.php" );
+require_once( "$IP/includes/Hooks.php" );
+require_once( "$IP/maintenance/parserTestsParserHook.php" );
 
 /**
  * @package MediaWiki
@@ -188,8 +190,8 @@ class ParserTest {
                        }
                }
                if( $total > 0 ) {
-                       $ratio = sprintf( "%.2f", 100 * $success / $total );
-                       print $this->termColor( 1 ) . "\nPassed $success of $total tests ($ratio%) ";
+                       $ratio = wfPercent( 100 * $success / $total );
+                       print $this->termColor( 1 ) . "\nPassed $success of $total tests ($ratio) ";
                        if( $success == $total ) {
                                print $this->termColor( 32 ) . "PASSED!";
                        } else {
@@ -219,7 +221,7 @@ class ParserTest {
                $this->setupGlobals($opts);
 
                $user =& new User();
-               $options =& ParserOptions::newFromUser( $user );
+               $options = ParserOptions::newFromUser( $user );
 
                if (preg_match('/\\bmath\\b/i', $opts)) {
                        # XXX this should probably be done by the ParserOptions
@@ -236,6 +238,7 @@ class ParserTest {
                }
 
                $parser =& new Parser();
+               wfRunHooks( 'ParserTestParser', array( &$parser ) );
                $title =& Title::makeTitle( NS_MAIN, $titleText );
 
                if (preg_match('/\\bpst\\b/i', $opts)) {
@@ -243,7 +246,7 @@ class ParserTest {
                } elseif (preg_match('/\\bmsg\\b/i', $opts)) {
                        $out = $parser->transformMsg( $input, $options );
                } else {
-                       $output =& $parser->parse( $input, $title, $options );
+                       $output = $parser->parse( $input, $title, $options );
                        $out = $output->getText();
 
                        if (preg_match('/\\bill\\b/i', $opts)) {
@@ -286,7 +289,7 @@ class ParserTest {
                        'wgScript' => '/index.php',
                        'wgScriptPath' => '/',
                        'wgArticlePath' => '/wiki/$1',
-                       'wgUploadPath' => '/images',
+                       'wgUploadPath' => 'http://example.com/images',
                        'wgUploadDirectory' => $this->uploadDir,
                        'wgStyleSheetPath' => '/skins',
                        'wgSitename' => 'MediaWiki',
@@ -303,6 +306,7 @@ class ParserTest {
                        'wgDefaultUserOptions' => array(),
                        'wgNoFollowLinks' => true,
                        'wgThumbnailScriptPath' => false,
+                       'wgUseTeX' => false,
                        );
                $this->savedGlobals = array();
                foreach( $settings as $var => $val ) {