From 6d5b5679fdc84a981bb495a8f88255a61c206f2f Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 13 Sep 2011 21:03:38 +0000 Subject: [PATCH] Followup r97001: fix for Math parser tests image URLs Setting $wgMathPath to a fixed value during parser test runs so the values are predictable. --- Math.hooks.php | 14 ++++++++++++++ Math.php | 1 + 2 files changed, 15 insertions(+) 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';