summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialJavaScriptTest.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
commit4ac9fa081a7c045f6a9f1cfc529d82423f485b2e (patch)
treeaf68743f2f4a47d13f2b0eb05f5c4aaf86d8ea37 /includes/specials/SpecialJavaScriptTest.php
parentaf4da56f1ad4d3ef7b06557bae365da2ea27a897 (diff)
Update to MediaWiki 1.22.0
Diffstat (limited to 'includes/specials/SpecialJavaScriptTest.php')
-rw-r--r--includes/specials/SpecialJavaScriptTest.php56
1 files changed, 36 insertions, 20 deletions
diff --git a/includes/specials/SpecialJavaScriptTest.php b/includes/specials/SpecialJavaScriptTest.php
index d204d50c..7069d527 100644
--- a/includes/specials/SpecialJavaScriptTest.php
+++ b/includes/specials/SpecialJavaScriptTest.php
@@ -55,24 +55,29 @@ class SpecialJavaScriptTest extends SpecialPage {
if ( $par == '' ) {
$out->setPageTitle( $this->msg( 'javascripttest' ) );
$summary = $this->wrapSummaryHtml(
- $this->msg( 'javascripttest-pagetext-noframework' )->escaped() . $this->getFrameworkListHtml(),
+ $this->msg( 'javascripttest-pagetext-noframework' )->escaped() .
+ $this->getFrameworkListHtml(),
'noframework'
);
$out->addHtml( $summary );
-
- // Matched! Display proper title and initialize the framework
} elseif ( isset( self::$frameworks[$framework] ) ) {
- $out->setPageTitle( $this->msg( 'javascripttest-title', $this->msg( "javascripttest-$framework-name" )->plain() ) );
- $out->setSubtitle( $this->msg( 'javascripttest-backlink' )->rawParams( Linker::linkKnown( $this->getTitle() ) ) );
+ // Matched! Display proper title and initialize the framework
+ $out->setPageTitle( $this->msg(
+ 'javascripttest-title',
+ // Messages: javascripttest-qunit-name
+ $this->msg( "javascripttest-$framework-name" )->plain()
+ ) );
+ $out->setSubtitle( $this->msg( 'javascripttest-backlink' )
+ ->rawParams( Linker::linkKnown( $this->getTitle() ) ) );
$this->{self::$frameworks[$framework]}();
-
- // Framework not found, display error
} else {
+ // Framework not found, display error
$out->setPageTitle( $this->msg( 'javascripttest' ) );
- $summary = $this->wrapSummaryHtml( '<p class="error">'
- . $this->msg( 'javascripttest-pagetext-unknownframework', $par )->escaped()
- . '</p>'
- . $this->getFrameworkListHtml(),
+ $summary = $this->wrapSummaryHtml(
+ '<p class="error">' .
+ $this->msg( 'javascripttest-pagetext-unknownframework', $par )->escaped() .
+ '</p>' .
+ $this->getFrameworkListHtml(),
'unknownframework'
);
$out->addHtml( $summary );
@@ -80,22 +85,28 @@ class SpecialJavaScriptTest extends SpecialPage {
}
/**
- * Get a list of frameworks (including introduction paragraph and links to the framework run pages)
- * @return String: HTML
+ * Get a list of frameworks (including introduction paragraph and links
+ * to the framework run pages)
+ *
+ * @return string HTML
*/
private function getFrameworkListHtml() {
$list = '<ul>';
- foreach( self::$frameworks as $framework => $initFn ) {
+ foreach ( self::$frameworks as $framework => $initFn ) {
$list .= Html::rawElement(
'li',
array(),
- Linker::link( $this->getTitle( $framework ), $this->msg( "javascripttest-$framework-name" )->escaped() )
+ Linker::link(
+ $this->getTitle( $framework ),
+ // Message: javascripttest-qunit-name
+ $this->msg( "javascripttest-$framework-name" )->escaped()
+ )
);
}
$list .= '</ul>';
- $msg = $this->msg( 'javascripttest-pagetext-frameworks' )->rawParams( $list )->parseAsBlock();
- return $msg;
+ return $this->msg( 'javascripttest-pagetext-frameworks' )->rawParams( $list )
+ ->parseAsBlock();
}
/**
@@ -109,12 +120,14 @@ class SpecialJavaScriptTest extends SpecialPage {
*/
private function wrapSummaryHtml( $html, $state ) {
$validStates = array( 'noframework', 'unknownframework', 'frameworkfound' );
- if( !in_array( $state, $validStates ) ) {
+
+ if ( !in_array( $state, $validStates ) ) {
throw new MWException( __METHOD__
. ' given an invalid state. Must be one of "'
- . join( '", "', $validStates) . '".'
+ . join( '", "', $validStates ) . '".'
);
}
+
return "<div id=\"mw-javascripttest-summary\" class=\"mw-javascripttest-$state\">$html</div>";
}
@@ -155,7 +168,10 @@ HTML;
// Used in ./tests/qunit/data/testrunner.js, see also documentation of
// $wgJavaScriptTestConfig in DefaultSettings.php
- $out->addJsConfigVars( 'QUnitTestSwarmInjectJSPath', $wgJavaScriptTestConfig['qunit']['testswarm-injectjs'] );
+ $out->addJsConfigVars(
+ 'QUnitTestSwarmInjectJSPath',
+ $wgJavaScriptTestConfig['qunit']['testswarm-injectjs']
+ );
}
protected function getGroupName() {