public function testRegister()
 {
     $language = $this->getMockBuilder('\\Language')->disableOriginalConstructor()->getMock();
     $globalVars = array('IP' => 'bar', 'wgVersion' => '1.24', 'wgLang' => $language);
     $instance = new HookRegistry($globalVars, 'foo');
     $instance->register();
     $this->doTestExecutionForParserAfterTidy($instance);
     $this->doTestExecutionForBaseTemplateToolbox($instance);
     $this->doTestExecutionForSkinAfterContent($instance);
     $this->doTestExecutionForOutputPageParserOutput($instance);
     $this->doTestExecutionForBeforePageDisplay($instance);
     $this->doTestExecutionForInternalParseBeforeLinks($instance);
     $this->doTestExecutionForNewRevisionFromEditComplete($instance);
     $this->doTestExecutionForTitleMoveComplete($instance);
     $this->doTestExecutionForArticlePurge($instance);
     $this->doTestExecutionForArticleDelete($instance);
     $this->doTestExecutionForLinksUpdateConstructed($instance);
     $this->doTestExecutionForSpecialStatsAddExtra($instance);
     $this->doTestExecutionForCanonicalNamespaces($instance);
     $this->doTestExecutionForFileUpload($instance);
     $this->doTestExecutionForResourceLoaderGetConfigVars($instance);
     $this->doTestExecutionForGetPreferences($instance);
     $this->doTestExecutionForSkinTemplateNavigation($instance);
     $this->doTestExecutionForLoadExtensionSchemaUpdates($instance);
     $this->doTestExecutionForResourceLoaderTestModules($instance);
     $this->doTestExecutionForExtensionTypes($instance);
     $this->doTestExecutionForTitleIsAlwaysKnown($instance);
     $this->doTestExecutionForBeforeDisplayNoArticleText($instance);
     $this->doTestExecutionForArticleFromTitle($instance);
     $this->doTestExecutionForTitleIsMovable($instance);
     $this->doTestExecutionForEditPageForm($instance);
     $this->doTestExecutionForParserFirstCallInit($instance);
     // Usage of registered hooks in/by smw-core
     $this->doTestExecutionForSMWStoreDropTables($instance);
     $this->doTestExecutionForSMWSQLStorAfterDataUpdateComplete($instance);
     $this->doTestExecutionForSMWStoreAfterQueryResultLookupComplete($instance);
 }
Ejemplo n.º 2
0
 /**
  * @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';
 }
Ejemplo n.º 3
0
 /**
  * @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;
     };
 }
Ejemplo n.º 4
0
 /**
  * @see https://www.mediawiki.org/wiki/Manual:$wgHooks
  *
  * @note $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();
     if (!$this->applicationFactory->getSettings()->get('smwgSemanticsEnabled')) {
         return;
     }
     // Old-style registration
     $this->globalVars['wgHooks']['AdminLinks'][] = 'SMWExternalHooks::addToAdminLinks';
     $this->globalVars['wgHooks']['PageSchemasRegisterHandlers'][] = 'SMWExternalHooks::onPageSchemasRegistration';
 }
Ejemplo n.º 5
0
 private function assertThatDefinitionIsClosure(HookRegistry $instance, $listOfItems)
 {
     foreach ($listOfItems as $name) {
         $this->assertInstanceOf('\\Closure', $instance->getDefinition($name));
     }
 }
Ejemplo n.º 6
0
 /**
  * @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'][] = 'SMW\\DocumentationParserFunction::staticInit';
     $this->globalVars['wgHooks']['ParserFirstCallInit'][] = 'SMW\\InfoParserFunction::staticInit';
 }