Followup r97001: fix for Math parser tests image URLs

Setting $wgMathPath to a fixed value during parser test runs so the values are predictable.
This commit is contained in:
Brion Vibber 2011-09-13 21:03:38 +00:00
parent ae124a1e73
commit 6d5b5679fd
2 changed files with 15 additions and 0 deletions

View file

@ -136,4 +136,18 @@ class MathHooks {
$tables[] = 'math';
return true;
}
/**
* Hack to fake a default $wgMathPath value so parser test output
* that renders to images doesn't vary by who runs it.
*
* @global string $wgMathPath
* @param Parser $parser
* @return bool
*/
static function onParserTestParser( &$parser ) {
global $wgMathPath;
$wgMathPath = '/images/math';
return true;
}
}

View file

@ -89,6 +89,7 @@ $wgHooks['ParserFirstCallInit'][] = 'MathHooks::onParserFirstCallInit';
$wgHooks['GetPreferences'][] = 'MathHooks::onGetPreferences';
$wgHooks['LoadExtensionSchemaUpdates'][] = 'MathHooks::onLoadExtensionSchemaUpdates';
$wgHooks['ParserTestTables'][] = 'MathHooks::onParserTestTables';
$wgHooks['ParserTestParser'][] = 'MathHooks::onParserTestParser';
$dir = dirname( __FILE__ ) . '/';
$wgAutoloadClasses['MathHooks'] = $dir . 'Math.hooks.php';