diff --git a/Math.hooks.php b/Math.hooks.php index eb7d8b2f1..4875838cc 100644 --- a/Math.hooks.php +++ b/Math.hooks.php @@ -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; + } } diff --git a/Math.php b/Math.php index 895144d6b..8799379ec 100644 --- a/Math.php +++ b/Math.php @@ -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';