function wikiplugin_fitnesse($data, $params) { $runner = Tracker_Field_Math::getRunner(); $mock = new FixtureMockTrackerField(); $runner->mockFunction('tracker-field', $mock); $fixtures = array('trackermath' => 'wp_fixture_tracker_math', 'trackerdata' => function ($data, $params) use($mock) { return wp_fixture_tracker_data($data, $params, $mock); }); $matches = WikiParser_PluginMatcher::match($data); $argParser = new WikiParser_PluginArgumentParser(); foreach ($matches as $table) { $fixture = $table->getName(); $arguments = $table->getArguments(); $arguments = $argParser->parse($arguments); $body = trim($table->getBody()); if (isset($fixtures[$fixture])) { $replace = call_user_func($fixtures[$fixture], $body, new JitFilter($arguments)); $table->replaceWith($replace); } else { $data = new FixtureTable($body); $table->replaceWith('__' . tr('Fixture not found: %0', $fixture) . "__\n{$data}"); } } Tracker_Field_Math::resetRunner(); return $matches->getText(); }
public static function resetRunner() { self::$runner = null; }