public function testRegister() { $language = $this->getMockBuilder('\\Language')->disableOriginalConstructor()->getMock(); $language->expects($this->any())->method('getCode')->will($this->returnValue('en')); $user = $this->getMockBuilder('\\User')->disableOriginalConstructor()->getMock(); $configuration = array('egSWLEnableTopLink' => false, 'egSWLEnableEmailNotify' => false, 'egSwlSqlDatabaseSchemaPath' => '../foo', 'wgLang' => $language); $wgHooks = array(); $instance = new HookRegistry($configuration); $instance->register($wgHooks); $this->assertNotEmpty($wgHooks); $this->doTestPersonalUrls($wgHooks, $user); $this->doTestUserSaveOptions($wgHooks, $user); $this->doTestLoadExtensionSchemaUpdates($wgHooks); $this->doTestGetPreferences($wgHooks, $user); $this->doTestStoreUpdate($wgHooks); }
$GLOBALS['wgAutoloadClasses']['SWLPropertyChanges'] = __DIR__ . '/includes/SWL_PropertyChanges.php'; $GLOBALS['wgAutoloadClasses']['SWLCustomTexts'] = __DIR__ . '/includes/SWL_CustomTexts.php'; $GLOBALS['wgAutoloadClasses']['SpecialSemanticWatchlist'] = __DIR__ . '/specials/SpecialSemanticWatchlist.php'; $GLOBALS['wgAutoloadClasses']['SpecialWatchlistConditions'] = __DIR__ . '/specials/SpecialWatchlistConditions.php'; $GLOBALS['wgSpecialPages']['SemanticWatchlist'] = 'SpecialSemanticWatchlist'; $GLOBALS['wgSpecialPageGroups']['SemanticWatchlist'] = 'changes'; $GLOBALS['wgSpecialPages']['WatchlistConditions'] = 'SpecialWatchlistConditions'; $GLOBALS['wgSpecialPageGroups']['WatchlistConditions'] = 'changes'; $GLOBALS['wgAPIModules']['addswlgroup'] = 'ApiAddWatchlistGroup'; $GLOBALS['wgAPIModules']['deleteswlgroup'] = 'ApiDeleteWatchlistGroup'; $GLOBALS['wgAPIModules']['editswlgroup'] = 'ApiEditWatchlistGroup'; $GLOBALS['wgAPIListModules']['semanticwatchlist'] = 'ApiQuerySemanticWatchlist'; $moduleTemplate = array('localBasePath' => __DIR__, 'remoteBasePath' => $GLOBALS['egSWLScriptPath']); $GLOBALS['wgResourceModules']['ext.swl.watchlist'] = $moduleTemplate + array('styles' => array('specials/ext.swl.watchlist.css'), 'scripts' => array(), 'dependencies' => array(), 'messages' => array()); $GLOBALS['wgResourceModules']['ext.swl.watchlistconditions'] = $moduleTemplate + array('styles' => array('specials/ext.swl.watchlistconditions.css'), 'scripts' => array('specials/jquery.watchlistcondition.js', 'specials/ext.swl.watchlistconditions.js'), 'dependencies' => array(), 'messages' => array('swl-group-name', 'swl-group-legend', 'swl-group-properties', 'swl-properties-list', 'swl-group-remove-property', 'swl-group-add-property', 'swl-group-page-selection', 'swl-group-save', 'swl-group-saved', 'swl-group-saving', 'swl-group-remove', 'swl-group-category', 'swl-group-namespace', 'swl-group-concept', 'swl-group-confirm-remove', 'swl-custom-legend', 'swl-custom-remove-property', 'swl-custom-text-add', 'swl-custom-input')); require_once 'SemanticWatchlist.settings.php'; $GLOBALS['wgAvailableRights'][] = 'semanticwatch'; $GLOBALS['wgAvailableRights'][] = 'semanticwatchgroups'; $GLOBALS['egSwlSqlDatabaseSchemaPath'] = __DIR__ . '/src/swl-table-schema.sql'; /** * @codeCoverageIgnore * * @since 1.0 */ call_user_func(function () { $GLOBALS['wgExtensionFunctions'][] = function () { $configuration = array('egSWLEnableTopLink' => $GLOBALS['egSWLEnableTopLink'], 'egSWLEnableEmailNotify' => $GLOBALS['egSWLEnableEmailNotify'], 'egSwlSqlDatabaseSchemaPath' => $GLOBALS['egSwlSqlDatabaseSchemaPath'], 'wgLang' => $GLOBALS['wgLang']); $hookRegistry = new HookRegistry($configuration); $hookRegistry->register($GLOBALS['wgHooks']); }; });