mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-23 22:13:34 +00:00
Don't break core's parserTests if VisualEditor is installed
VisualEditor's hook changes the edit section link, which changes the output of certain parser tests so that they no longer match the expected text. Use the `ParserTestsGlobal` hook (which cleans up after itself when the parserTests ends) to disable the `onDoEditSectionLink` hook when we're running parserTests to avoid the spurious failures. Change-Id: Ic958d88f443ac37ba304d3256e2bb5ea2fde820d
This commit is contained in:
parent
4c12f1841a
commit
21cd7bad53
|
@ -170,7 +170,9 @@ class VisualEditorHooks {
|
|||
*/
|
||||
public static function onDoEditSectionLink( $skin, $title, $section, $tooltip, &$result, $lang ) {
|
||||
// Only do this if the user has VE enabled
|
||||
// (and we're not in parserTests)
|
||||
if (
|
||||
isset( $GLOBALS[ 'wgVisualEditorInParserTests' ] ) ||
|
||||
!$skin->getUser()->getOption( 'visualeditor-enable' ) ||
|
||||
$skin->getUser()->getOption( 'visualeditor-betatempdisable' )
|
||||
) {
|
||||
|
@ -384,4 +386,11 @@ class VisualEditorHooks {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensures that we know whether we're running inside a parser test.
|
||||
*/
|
||||
public static function onParserTestGlobals( array &$settings ) {
|
||||
$settings['wgVisualEditorInParserTests'] = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,7 @@ $wgHooks['MakeGlobalVariablesScript'][] = 'VisualEditorHooks::onMakeGlobalVariab
|
|||
$wgHooks['ResourceLoaderGetConfigVars'][] = 'VisualEditorHooks::onResourceLoaderGetConfigVars';
|
||||
$wgHooks['ResourceLoaderTestModules'][] = 'VisualEditorHooks::onResourceLoaderTestModules';
|
||||
$wgHooks['SkinTemplateNavigation'][] = 'VisualEditorHooks::onSkinTemplateNavigation';
|
||||
$wgHooks['ParserTestGlobals'][] = 'VisualEditorHooks::onParserTestGlobals';
|
||||
$wgExtensionFunctions[] = 'VisualEditorHooks::onSetup';
|
||||
|
||||
// Set default values for new preferences
|
||||
|
|
Loading…
Reference in a new issue