Go to the documentation of this file.
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(),
99 'debug' => ResourceLoader::inDebugMode() ?
'true' :
'false',
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' ),
128 $code = ResourceLoader::makeConfigSetScript(
$out->getJSVars() );
130 $code .= $rl->makeModuleResponse( $embedContext, [
131 'user.options' => $rl->getModule(
'user.options' ),
132 'user.tokens' => $rl->getModule(
'user.tokens' ),
140 var start = window.__karma__ ? window.__karma__.start : QUnit.start;
143 .always(
function () {
146 .fail(
function (
e ) {
147 setTimeout(
function () {
158 header(
'Content-Type: text/javascript; charset=utf-8' );
159 header(
'Cache-Control: private, no-cache, must-revalidate' );
160 header(
'Pragma: no-cache' );
164 echo ResourceLoader::makeLoaderConditionalScript(
$code );
171 $styles =
$out->makeResourceLoaderLink(
'jquery.qunit',
178 $scripts =
$out->makeResourceLoaderLink(
'jquery.qunit',
180 [
'raw' =>
true,
'sync' =>
true ]
183 $head = implode(
"\n", [ $styles, $scripts ] );
190 <div
id=
"qunit"></div>
193 $url = $this->
getPageTitle(
'qunit/export' )->getFullURL( [
194 'debug' => ResourceLoader::inDebugMode() ?
'true' :
'false',
198 header(
'Content-Type: text/html; charset=utf-8' );
208 return self::$frameworks;
getPageTitle( $subpage=false)
Get a self-referential title object.
Object passed around to modules which contains information about the state of a specific loader reque...
WebRequest clone which takes values from a provided array.
msg( $key)
Wrapper around wfMessage that sets the current context.
execute( $par)
Default execute method Checks user permissions.
getSummaryHtml()
Get summary text wrapped in a container.
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept.
getOutput()
Get the OutputPage being used for this instance.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getSkin()
Shortcut to get the skin being used for this instance.
getLanguage()
Shortcut to get user's language.
static encodeJsVar( $value, $pretty=false)
Encode a variable of arbitrary type to JavaScript.
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
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
null for the 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
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
static linkedScript( $url)
Output a "<script>" tag linking to the given URL, e.g., "<script src=foo.js></script>".
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
in this case you re responsible for computing and outputting the entire conflict i e
Parent class for all special pages.
exportQUnit()
Generate self-sufficient JavaScript payload to run the tests elsewhere.
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
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