30 parent::__construct(
'JavaScriptTest' );
37 $out->disallowUserJs();
42 $out->allowClickjacking();
45 if ( $par ===
'qunit/export' ) {
52 if ( $par ===
null || $par ===
'' || $par ===
'qunit' || $par ===
'qunit/plain' ) {
58 $out->setStatusCode( 404 );
59 $out->setPageTitle( $this->
msg(
'javascripttest' ) );
62 . $this->
msg(
'javascripttest-pagetext-unknownaction' )
63 ->plaintextParams( $par )->parseAsBlock()
74 $summary = $this->
msg(
'javascripttest-qunit-intro' )
75 ->params(
'https://www.mediawiki.org/wiki/Manual:JavaScript_unit_testing' )
77 return "<div id=\"mw-javascripttest-summary\">$summary</div>";
94 $rl =
$out->getResourceLoader();
98 'skin' => $this->
getSkin()->getSkinName(),
103 $query[
'only'] =
'scripts';
108 $modules = $rl->getTestModuleNames(
'qunit' );
113 $qunitConfig =
'QUnit.config.autostart = false;'
114 .
'if (window.__karma__) {'
118 .
'window.__karma__.loaded = function () {};'
122 $startup = $rl->makeModuleResponse( $startupContext, [
123 'startup' => $rl->getModule(
'startup' ),
130 $code .= $rl->makeModuleResponse( $embedContext, [
131 'user.options' => $rl->getModule(
'user.options' ),
132 'user.tokens' => $rl->getModule(
'user.tokens' ),
137 $code .=
'(function () {'
138 .
'var start = window.__karma__ ? window.__karma__.start : QUnit.start;'
141 .
'} catch ( e ) { start(); throw e; }'
144 header(
'Content-Type: text/javascript; charset=utf-8' );
145 header(
'Cache-Control: private, no-cache, must-revalidate' );
146 header(
'Pragma: no-cache' );
157 $styles =
$out->makeResourceLoaderLink(
'jquery.qunit',
164 $scripts =
$out->makeResourceLoaderLink(
'jquery.qunit',
166 [
'raw' =>
true,
'sync' =>
true ]
169 $head = implode(
"\n", [ $styles, $scripts ] );
176<div
id=
"qunit"></div>
179 $url = $this->
getPageTitle(
'qunit/export' )->getFullURL( [
182 $html .=
"\n" . Html::linkedScript( $url );
184 header(
'Content-Type: text/html; charset=utf-8' );
194 return self::$frameworks;
WebRequest clone which takes values from a provided array.
Object passed around to modules which contains information about the state of a specific loader reque...
static makeLoaderConditionalScript( $script)
Returns JS code which runs given JS code if the client-side framework is present.
static inDebugMode()
Determine whether debug mode was requested Order of priority is 1) request param, 2) cookie,...
static makeConfigSetScript(array $configuration)
Returns JS code which will set the MediaWiki configuration array to the given value.
exportQUnit()
Generate self-sufficient JavaScript payload to run the tests elsewhere.
execute( $par)
Default execute method Checks user permissions.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
getSummaryHtml()
Get summary text wrapped in a container.
Parent class for all special pages.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getSkin()
Shortcut to get the skin being used for this instance.
getPageTitle( $subpage=false)
Get a self-referential title object.
getLanguage()
Shortcut to get user's language.
msg()
Wrapper around wfMessage that sets the current context.
static encodeJsVar( $value, $pretty=false)
Encode a variable of arbitrary type to JavaScript.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php