/** * @see https://www.mediawiki.org/wiki/Manual:$this->globalVars['wgHooks'] * * @note $this->globalVars['wgHooks'] contains a list of hooks which specifies for every event an * array of functions to be called. */ private function registerHooks() { $hookRegistry = new HookRegistry($this->globalVars, $this->directory); $hookRegistry->register(); // Old-style registration $this->globalVars['wgHooks']['AdminLinks'][] = 'SMWHooks::addToAdminLinks'; $this->globalVars['wgHooks']['PageSchemasRegisterHandlers'][] = 'SMWHooks::onPageSchemasRegistration'; $this->globalVars['wgHooks']['ParserFirstCallInit'][] = function (\Parser &$parser) { $hookRegistrant = new HookRegistrant($parser); $infoFunctionDefinition = InfoParserFunction::getHookDefinition(); $infoFunctionHandler = new InfoParserFunction(); $hookRegistrant->registerFunctionHandler($infoFunctionDefinition, $infoFunctionHandler); $hookRegistrant->registerHookHandler($infoFunctionDefinition, $infoFunctionHandler); $docsFunctionDefinition = DocumentationParserFunction::getHookDefinition(); $docsFunctionHandler = new DocumentationParserFunction(); $hookRegistrant->registerFunctionHandler($docsFunctionDefinition, $docsFunctionHandler); $hookRegistrant->registerHookHandler($docsFunctionDefinition, $docsFunctionHandler); return true; }; }
public function testStaticInit() { $parser = $this->getMockBuilder('\\Parser')->disableOriginalConstructor()->getMock(); $this->assertTrue(DocumentationParserFunction::staticInit($parser)); }