Update formatting
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Fri, 15 Feb 2013 10:35:55 +0000 (11:35 +0100)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 15 Feb 2013 13:08:55 +0000 (13:08 +0000)
8 of n.

Change-Id: I55551510e7afde5b6b981697d5c0efd7b9507585

35 files changed:
tests/phpunit/includes/upload/UploadFromUrlTest.php
tests/phpunit/includes/upload/UploadStashTest.php
tests/phpunit/languages/utils/CLDRPluralRuleEvaluatorTest.php
tests/phpunit/maintenance/DumpTestCase.php
tests/phpunit/maintenance/backupPrefetchTest.php
tests/phpunit/maintenance/backup_LogTest.php
tests/phpunit/phpunit.php
tests/phpunit/resources/ResourcesTest.php
tests/phpunit/suites/ExtensionsTestSuite.php
tests/qunit/data/generateJqueryMsgData.php
tests/qunit/data/qunitOkCall.js
tests/qunit/data/styleTest.css.php
tests/qunit/suites/resources/jquery/jquery.autoEllipsis.test.js
tests/qunit/suites/resources/jquery/jquery.byteLength.test.js
tests/qunit/suites/resources/jquery/jquery.colorUtil.test.js
tests/qunit/suites/resources/jquery/jquery.delayedBind.test.js
tests/qunit/suites/resources/jquery/jquery.getAttrs.test.js
tests/qunit/suites/resources/jquery/jquery.hidpi.test.js
tests/qunit/suites/resources/jquery/jquery.localize.test.js
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.parse.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.language.test.js
tests/selenium/SeleniumConfig.php
tests/selenium/SeleniumTestListener.php
tests/selenium/SeleniumTestSuite.php
tests/selenium/installer/MediaWikiInstallationConfig.php
tests/selenium/installer/MediaWikiInstallationMessage.php
tests/selenium/installer/MediaWikiInstallationVariables.php
tests/selenium/installer/MediaWikiInstallerTestSuite.php
tests/selenium/suites/MediaWikiEditorConfig.php
tests/selenium/suites/MediaWikiExtraTestSuite.php
tests/selenium/suites/MediawikiCoreSmokeTestCase.php
tests/selenium/suites/MediawikiCoreSmokeTestSuite.php
tests/selenium/suites/PageDeleteTestSuite.php
tests/selenium/suites/SimpleSeleniumTestCase.php
tests/selenium/suites/SimpleSeleniumTestSuite.php

index a693cdb..4d2d8ce 100644 (file)
@@ -336,7 +336,7 @@ class UploadFromUrlTest extends ApiTestCase {
         */
        protected function deleteFile( $name ) {
                $t = Title::newFromText( $name, NS_FILE );
-               $this->assertTrue($t->exists(), "File '$name' exists");
+               $this->assertTrue( $t->exists(), "File '$name' exists" );
 
                if ( $t->exists() ) {
                        $file = wfFindFile( $name, array( 'ignoreRedirect' => true ) );
@@ -347,6 +347,6 @@ class UploadFromUrlTest extends ApiTestCase {
                }
                $t = Title::newFromText( $name, NS_FILE );
 
-               $this->assertFalse($t->exists(), "File '$name' was deleted");
+               $this->assertFalse( $t->exists(), "File '$name' was deleted" );
        }
- }
+}
index 857aef5..8fcaa21 100644 (file)
@@ -59,19 +59,19 @@ class UploadStashTest extends MediaWikiTestCase {
        }
 
        public function testValidRequest() {
-               $request = new FauxRequest( array( 'wpFileKey' => 'foo') );
-               $this->assertFalse( UploadFromStash::isValidRequest($request), 'Check failure on bad wpFileKey' );
+               $request = new FauxRequest( array( 'wpFileKey' => 'foo' ) );
+               $this->assertFalse( UploadFromStash::isValidRequest( $request ), 'Check failure on bad wpFileKey' );
 
-               $request = new FauxRequest( array( 'wpSessionKey' => 'foo') );
-               $this->assertFalse( UploadFromStash::isValidRequest($request), 'Check failure on bad wpSessionKey' );
+               $request = new FauxRequest( array( 'wpSessionKey' => 'foo' ) );
+               $this->assertFalse( UploadFromStash::isValidRequest( $request ), 'Check failure on bad wpSessionKey' );
 
-               $request = new FauxRequest( array( 'wpFileKey' => 'testkey-test.test') );
-               $this->assertTrue( UploadFromStash::isValidRequest($request), 'Check good wpFileKey' );
+               $request = new FauxRequest( array( 'wpFileKey' => 'testkey-test.test' ) );
+               $this->assertTrue( UploadFromStash::isValidRequest( $request ), 'Check good wpFileKey' );
 
-               $request = new FauxRequest( array( 'wpFileKey' => 'testkey-test.test') );
-               $this->assertTrue( UploadFromStash::isValidRequest($request), 'Check good wpSessionKey' );
+               $request = new FauxRequest( array( 'wpFileKey' => 'testkey-test.test' ) );
+               $this->assertTrue( UploadFromStash::isValidRequest( $request ), 'Check good wpSessionKey' );
 
-               $request = new FauxRequest( array( 'wpFileKey' => 'testkey-test.test', 'wpSessionKey' => 'foo') );
-               $this->assertTrue( UploadFromStash::isValidRequest($request), 'Check key precedence' );
+               $request = new FauxRequest( array( 'wpFileKey' => 'testkey-test.test', 'wpSessionKey' => 'foo' ) );
+               $this->assertTrue( UploadFromStash::isValidRequest( $request ), 'Check key precedence' );
        }
 }
index 58fcf16..73d5dcc 100644 (file)
@@ -31,19 +31,19 @@ class CLDRPluralRuleEvaluatorTest extends MediaWikiTestCase {
                        array( 1, 'n is 1', 1.1, 'float number and is' ),
                        array( 1, 'n is 1', 2, 'float number and is' ),
 
-                       array( 0, 'n in 1,3,5',     3, '' ),
+                       array( 0, 'n in 1,3,5', 3, '' ),
                        array( 1, 'n not in 1,3,5', 5, '' ),
 
-                       array( 1, 'n in 1,3,5',     2, '' ),
+                       array( 1, 'n in 1,3,5', 2, '' ),
                        array( 0, 'n not in 1,3,5', 4, '' ),
 
-                       array( 0, 'n in 1..3',      2, '' ),
-                       array( 0, 'n in 1..3',      3, 'in is inclusive' ),
-                       array( 1, 'n in 1..3',      0, '' ),
+                       array( 0, 'n in 1..3', 2, '' ),
+                       array( 0, 'n in 1..3', 3, 'in is inclusive' ),
+                       array( 1, 'n in 1..3', 0, '' ),
 
-                       array( 1, 'n not in 1..3',      2, '' ),
-                       array( 1, 'n not in 1..3',      3, 'in is inclusive' ),
-                       array( 0, 'n not in 1..3',      0, '' ),
+                       array( 1, 'n not in 1..3', 2, '' ),
+                       array( 1, 'n not in 1..3', 3, 'in is inclusive' ),
+                       array( 0, 'n not in 1..3', 0, '' ),
 
                        array( 1, 'n is not 1 and n is not 2 and n is not 3', 1, 'and relation' ),
                        array( 0, 'n is not 1 and n is not 2 and n is not 4', 3, 'and relation' ),
index 106fab8..40d24fc 100644 (file)
@@ -121,7 +121,8 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
        protected function skipToNodeEnd( $name ) {
                while ( $this->xml->read() ) {
                        if ( $this->xml->nodeType == XMLReader::END_ELEMENT &&
-                               $this->xml->name == $name ) {
+                               $this->xml->name == $name
+                       ) {
                                return true;
                        }
                }
@@ -189,7 +190,7 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
        protected function skipWhitespace() {
                $cont = true;
                while ( $cont && ( ( $this->xml->nodeType == XMLReader::WHITESPACE )
-                               || ( $this->xml->nodeType == XMLReader::SIGNIFICANT_WHITESPACE ) ) ) {
+                       || ( $this->xml->nodeType == XMLReader::SIGNIFICANT_WHITESPACE ) ) ) {
                        $cont = $this->xml->read();
                }
        }
@@ -300,7 +301,7 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
         * @param $parentid int|false: (optional) id of the parent revision
         */
        protected function assertRevision( $id, $summary, $text_id, $text_bytes, $text_sha1, $text = false, $parentid = false,
-                                               $model = CONTENT_MODEL_WIKITEXT, $format = CONTENT_FORMAT_WIKITEXT ) {
+                                                                          $model = CONTENT_MODEL_WIKITEXT, $format = CONTENT_FORMAT_WIKITEXT ) {
 
                $this->assertNodeStart( "revision" );
                $this->skipWhitespace();
@@ -358,7 +359,8 @@ abstract class DumpTestCase extends MediaWikiLangTestCase {
                        $this->assertFalse( $this->xml->hasValue, "Revision has text" );
                        $this->assertTrue( $this->xml->read(), "Skipping text start tag" );
                        if ( ( $this->xml->nodeType == XMLReader::END_ELEMENT )
-                               && ( $this->xml->name == "text" ) ) {
+                               && ( $this->xml->name == "text" )
+                       ) {
 
                                $this->xml->read();
                        }
index a029c92..cc00e6e 100644 (file)
@@ -265,12 +265,12 @@ class BaseDumpTest extends MediaWikiTestCase {
                foreach ( $requested_pages as $i ) {
                        $this->assertTrue( array_key_exists( $i, $available_pages ),
                                "Check for availability of requested page " . $i );
-                       $content .= $available_pages[ $i ];
+                       $content .= $available_pages[$i];
                }
                $content .= $tail;
 
                $this->assertEquals( strlen( $content ), file_put_contents(
-                               $fname, $content ), "Length of prepared prefetch" );
+                       $fname, $content ), "Length of prepared prefetch" );
 
                return $fname;
        }
index afd8f43..5cf172e 100644 (file)
@@ -28,18 +28,18 @@ class BackupDumperLoggerTest extends DumpTestCase {
         * @return int id of the added log entry
         */
        private function addLogEntry( $type, $subtype, User $user, $ns, $title,
-               $comment = null, $parameters = null ) {
-
-                $logEntry = new ManualLogEntry( $type, $subtype );
+               $comment = null, $parameters = null
+       ) {
+               $logEntry = new ManualLogEntry( $type, $subtype );
                $logEntry->setPerformer( $user );
                $logEntry->setTarget( Title::newFromText( $title, $ns ) );
-                if ( $comment !== null ) {
+               if ( $comment !== null ) {
                        $logEntry->setComment( $comment );
                }
-                if ( $parameters !== null ) {
+               if ( $parameters !== null ) {
                        $logEntry->setParameters( $parameters );
                }
-                return $logEntry->insert();
+               return $logEntry->insert();
        }
 
        function addDBData() {
@@ -73,7 +73,7 @@ class BackupDumperLoggerTest extends DumpTestCase {
 
                        $this->logId3 = $this->addLogEntry( 'move', 'delete',
                                $user2, NS_MAIN, "PageA", "SomeOtherComment",
-                               array( 'key1' => 1,  3 => 'value3' ) );
+                               array( 'key1' => 1, 3 => 'value3' ) );
                        $this->assertGreaterThan( 0, $this->logId3 );
 
                } catch ( Exception $e ) {
@@ -101,7 +101,8 @@ class BackupDumperLoggerTest extends DumpTestCase {
         * @param $parameters array: (optional) unserialized data accompanying the log entry
         */
        private function assertLogItem( $id, $user_name, $user_id, $comment, $type,
-               $subtype, $title, $parameters = array() ) {
+               $subtype, $title, $parameters = array()
+       ) {
 
                $this->assertNodeStart( "logitem" );
                $this->skipWhitespace();
@@ -134,12 +135,12 @@ class BackupDumperLoggerTest extends DumpTestCase {
                $this->skipWhitespace();
        }
 
-       function testPlain () {
+       function testPlain() {
                global $wgContLang;
 
                // Preparing the dump
                $fname = $this->getNewTempFile();
-               $dumper = new BackupDumper( array ( "--output=file:" . $fname ) );
+               $dumper = new BackupDumper( array( "--output=file:" . $fname ) );
                $dumper->startId = $this->logId1;
                $dumper->endId = $this->logId3 + 1;
                $dumper->reporting = false;
@@ -176,8 +177,8 @@ class BackupDumperLoggerTest extends DumpTestCase {
 
                // Preparing the dump
                $fname = $this->getNewTempFile();
-               $dumper = new BackupDumper( array ( "--output=gzip:" . $fname,
-                               "--reporting=2" ) );
+               $dumper = new BackupDumper( array( "--output=gzip:" . $fname,
+                       "--reporting=2" ) );
                $dumper->startId = $this->logId1;
                $dumper->endId = $this->logId3 + 1;
                $dumper->setDb( $this->db );
index bcbf4ec..2a0298a 100755 (executable)
@@ -21,10 +21,10 @@ class PHPUnitMaintClass extends Maintenance {
 
        function __construct() {
                parent::__construct();
-               $this->addOption( 'with-phpunitdir'
-                       , 'Directory to include PHPUnit from, for example when using a git fetchout from upstream. Path will be prepended to PHP `include_path`.'
-                       , false # not required
-                       , true  # need arg
+               $this->addOption( 'with-phpunitdir',
+                       'Directory to include PHPUnit from, for example when using a git fetchout from upstream. Path will be prepended to PHP `include_path`.',
+                       false, # not required
+                       true # need arg
                );
        }
 
@@ -49,26 +49,26 @@ class PHPUnitMaintClass extends Maintenance {
                // Assume UTC for testing purposes
                $wgLocaltimezone = 'UTC';
 
-               $wgLocalisationCacheConf['storeClass'] =  'LCStore_Null';
+               $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null';
        }
 
        public function execute() {
                global $IP;
 
                # Make sure we have --configuration or PHPUnit might complain
-               if( !in_array( '--configuration', $_SERVER['argv'] ) ) {
+               if ( !in_array( '--configuration', $_SERVER['argv'] ) ) {
                        //Hack to eliminate the need to use the Makefile (which sucks ATM)
                        array_splice( $_SERVER['argv'], 1, 0,
                                array( '--configuration', $IP . '/tests/phpunit/suite.xml' ) );
                }
 
                # --with-phpunitdir let us override the default PHPUnit version
-               if( $phpunitDir = $this->getOption( 'with-phpunitdir' ) ) {
+               if ( $phpunitDir = $this->getOption( 'with-phpunitdir' ) ) {
                        # Sanity checks
-                       if( !is_dir($phpunitDir) ) {
+                       if ( !is_dir( $phpunitDir ) ) {
                                $this->error( "--with-phpunitdir should be set to an existing directory", 1 );
                        }
-                       if( !is_readable( $phpunitDir."/PHPUnit/Runner/Version.php" ) ) {
+                       if ( !is_readable( $phpunitDir . "/PHPUnit/Runner/Version.php" ) ) {
                                $this->error( "No usable PHPUnit installation in $phpunitDir.\nAborting.\n", 1 );
                        }
 
@@ -80,8 +80,8 @@ class PHPUnitMaintClass extends Maintenance {
                        # Cleanup $args array so the option and its value do not
                        # pollute PHPUnit
                        $key = array_search( '--with-phpunitdir', $_SERVER['argv'] );
-                       unset( $_SERVER['argv'][$key]   ); // the option
-                       unset( $_SERVER['argv'][$key+1] ); // its value
+                       unset( $_SERVER['argv'][$key] ); // the option
+                       unset( $_SERVER['argv'][$key + 1] ); // its value
                        $_SERVER['argv'] = array_values( $_SERVER['argv'] );
 
                }
@@ -97,8 +97,9 @@ require( RUN_MAINTENANCE_IF_MAIN );
 
 require_once( 'PHPUnit/Runner/Version.php' );
 
-if( PHPUnit_Runner_Version::id() !== '@package_version@'
-   && version_compare( PHPUnit_Runner_Version::id(), '3.6.7', '<' ) ) {
+if ( PHPUnit_Runner_Version::id() !== '@package_version@'
+       && version_compare( PHPUnit_Runner_Version::id(), '3.6.7', '<' )
+) {
        die( 'PHPUnit 3.6.7 or later required, you have ' . PHPUnit_Runner_Version::id() . ".\n" );
 }
 require_once( 'PHPUnit/Autoload.php' );
index 18db399..71b8c67 100644 (file)
@@ -62,7 +62,7 @@ class ResourcesTest extends MediaWikiTestCase {
 
                foreach ( $rl->getModuleNames() as $moduleName ) {
                        $module = $rl->getModule( $moduleName );
-                       if ( ! $module instanceof ResourceLoaderFileModule ) {
+                       if ( !$module instanceof ResourceLoaderFileModule ) {
                                continue;
                        }
 
index d728807..eec773d 100644 (file)
@@ -1,4 +1,4 @@
-<?php 
+<?php
 /**
  * This test suite runs unit tests registered by extensions.
  * See http://www.mediawiki.org/wiki/Manual:Hooks/UnitTestsList for details of how to register your tests.
index 911dc3a..774000b 100644 (file)
@@ -85,9 +85,9 @@ class GenerateJqueryMsgData extends Maintenance {
        );
 
        public function __construct() {
-                       parent::__construct();
-                       $this->mDescription = 'Create a specification for message parsing ini JSON format';
-                       // add any other options here
+               parent::__construct();
+               $this->mDescription = 'Create a specification for message parsing ini JSON format';
+               // add any other options here
        }
 
        public function execute() {
@@ -100,7 +100,7 @@ class GenerateJqueryMsgData extends Maintenance {
                $tests = array();
                foreach ( array( 'en', 'fr', 'ar', 'jp', 'zh' ) as $languageCode ) {
                        foreach ( self::$keyToTestArgs as $key => $testArgs ) {
-                               foreach ($testArgs as $args) {
+                               foreach ( $testArgs as $args ) {
                                        // Get the raw message, without any transformations.
                                        $template = wfMessage( $key )->inLanguage( $languageCode )->plain();
 
@@ -132,14 +132,14 @@ class GenerateJqueryMsgData extends Maintenance {
 
                $output =
                        "// This file stores the output from the PHP parser for various messages, arguments,\n"
-                       . "// languages, and parser modes. Intended for use by a unit test framework by looping\n"
-                       . "// through the object and comparing its parser return value with the 'result' property.\n"
-                       . '// Last generated with ' . basename( __FILE__ ) . ' at ' . gmdate( 'r' ) . "\n"
-                       // This file will contain unquoted JSON strings as javascript native object literals,
-                       // flip the quotemark convention for this file.
-                       . "/*jshint quotmark: double */\n"
-                       . "\n"
-                       . 'mediaWiki.libs.phpParserData = ' . FormatJson::encode( $phpParserData, true ) . ";\n";
+                               . "// languages, and parser modes. Intended for use by a unit test framework by looping\n"
+                               . "// through the object and comparing its parser return value with the 'result' property.\n"
+                               . '// Last generated with ' . basename( __FILE__ ) . ' at ' . gmdate( 'r' ) . "\n"
+                               // This file will contain unquoted JSON strings as javascript native object literals,
+                               // flip the quotemark convention for this file.
+                               . "/*jshint quotmark: double */\n"
+                               . "\n"
+                               . 'mediaWiki.libs.phpParserData = ' . FormatJson::encode( $phpParserData, true ) . ";\n";
 
                $fp = file_put_contents( $dataSpecFile, $output );
                if ( $fp === false ) {
index 25c42d6..3ed5514 100644 (file)
@@ -1,2 +1,2 @@
 QUnit.start();
-QUnit.assert.ok( true, 'Successfully loaded!');
+QUnit.assert.ok( true, 'Successfully loaded!' );
index 1870d5a..0e84581 100644 (file)
@@ -47,9 +47,9 @@ $wait = isset( $params['wait'] ) ? (int)$params['wait'] : 0; // seconds
 
 sleep( $wait );
 
-$css =  "
+$css = "
 /**
- * Generated " . gmdate( 'r' ) .  ".
+ * Generated " . gmdate( 'r' ) . ".
  * Waited {$wait}s.
  */
 
index feeec55..e189524 100644 (file)
@@ -53,6 +53,6 @@
                } else {
                        assert.gt( $span.width(), $span.parent().width(), 'Fit is maximal (adding two characters makes it not fit any more)' );
                }
-       });
+       } );
 
 }( jQuery ) );
index 378ea4b..e4e579b 100644 (file)
@@ -2,7 +2,7 @@
        QUnit.module( 'jquery.byteLength', QUnit.newMwEnvironment() );
 
        QUnit.test( 'Simple text', 5, function ( assert ) {
-               var     azLc = 'abcdefghijklmnopqrstuvwxyz',
+               var azLc = 'abcdefghijklmnopqrstuvwxyz',
                        azUc = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
                        num = '0123456789',
                        x = '*',
index 51a892e..97e0533 100644 (file)
@@ -24,7 +24,7 @@
                assert.deepEqual( $.colorUtil.getRGB( 'lightGreen' ), [144, 238, 144], 'Color names (lightGreen)' );
                assert.deepEqual( $.colorUtil.getRGB( 'transparent' ), [255, 255, 255], 'Color names (transparent)' );
                assert.strictEqual( $.colorUtil.getRGB( 'mediaWiki' ), undefined, 'Inexisting color name' );
-       });
+       } );
 
        QUnit.test( 'rgbToHsl', 1, function ( assert ) {
                var hsl, ret;
                function dualDecimals( a ) {
                        return Math.round( a * 100 ) / 100;
                }
+
                // Re-create the rgbToHsl return array items, limited to two decimals.
                hsl = $.colorUtil.rgbToHsl( 144, 238, 144 );
                ret = [ dualDecimals( hsl[0] ), dualDecimals( hsl[1] ), dualDecimals( hsl[2] ) ];
 
                assert.deepEqual( ret, [0.33, 0.73, 0.75], 'rgb(144, 238, 144): hsl(0.33, 0.73, 0.75)' );
-       });
+       } );
 
        QUnit.test( 'hslToRgb', 1, function ( assert ) {
                var rgb, ret;
                rgb = $.colorUtil.hslToRgb( 0.3, 0.7, 0.8 );
 
                // Re-create the hslToRgb return array items, rounded to whole numbers.
-               ret = [ Math.round(rgb[0]), Math.round(rgb[1]), Math.round(rgb[2]) ];
+               ret = [ Math.round( rgb[0] ), Math.round( rgb[1] ), Math.round( rgb[2] ) ];
 
-               assert.deepEqual( ret ,[183, 240, 168], 'hsl(0.3, 0.7, 0.8): rgb(183, 240, 168)' );
-       });
+               assert.deepEqual( ret[183, 240, 168], 'hsl(0.3, 0.7, 0.8): rgb(183, 240, 168)' );
+       } );
 
        QUnit.test( 'getColorBrightness', 2, function ( assert ) {
                var a, b;
@@ -58,5 +59,5 @@
 
                b = $.colorUtil.getColorBrightness( 'rgb(200,50,50)', -0.2 );
                assert.equal( b, 'rgb(118,29,29)', 'Start with rgb string "rgb(200,50,50)", darken 20%' );
-       });
+       } );
 }( jQuery ) );
index 3e7d5ff..234b19c 100644 (file)
@@ -1,37 +1,37 @@
 ( function ( $ ) {
-       QUnit.asyncTest('jquery.delayedBind with data option', 2, function ( assert ) {
-               var $fixture = $('<div>').appendTo('#qunit-fixture'),
+       QUnit.asyncTest( 'jquery.delayedBind with data option', 2, function ( assert ) {
+               var $fixture = $( '<div>' ).appendTo( '#qunit-fixture' ),
                        data = {
                                magic: 'beeswax'
                        },
                        delay = 50;
 
-               $fixture.delayedBind(delay, 'testevent', data, function ( e ) {
-                       assert.ok( true, 'testevent fired');
-                       assert.ok( e.data === data, 'data is passed through delayedBind');
+               $fixture.delayedBind( delay, 'testevent', data, function ( e ) {
+                       assert.ok( true, 'testevent fired' );
+                       assert.ok( e.data === data, 'data is passed through delayedBind' );
                        QUnit.start();
-               });
+               } );
 
                // We'll trigger it thrice, but it should only happen once.
                $fixture.trigger( 'testevent', {} );
                $fixture.trigger( 'testevent', {} );
                $fixture.trigger( 'testevent', {} );
                $fixture.trigger( 'testevent', {} );
-       });
+       } );
 
-       QUnit.asyncTest('jquery.delayedBind without data option', 1, function ( assert ) {
-               var $fixture = $('<div>').appendTo('#qunit-fixture'),
+       QUnit.asyncTest( 'jquery.delayedBind without data option', 1, function ( assert ) {
+               var $fixture = $( '<div>' ).appendTo( '#qunit-fixture' ),
                        delay = 50;
 
-               $fixture.delayedBind(delay, 'testevent', function () {
-                       assert.ok(true, 'testevent fired');
+               $fixture.delayedBind( delay, 'testevent', function () {
+                       assert.ok( true, 'testevent fired' );
                        QUnit.start();
-               });
+               } );
 
                // We'll trigger it thrice, but it should only happen once.
                $fixture.trigger( 'testevent', {} );
                $fixture.trigger( 'testevent', {} );
                $fixture.trigger( 'testevent', {} );
                $fixture.trigger( 'testevent', {} );
-       });
+       } );
 }( jQuery ) );
index 82566c2..0b7e87e 100644 (file)
@@ -2,7 +2,7 @@
        QUnit.module( 'jquery.getAttrs', QUnit.newMwEnvironment() );
 
        QUnit.test( 'Check', 1, function ( assert ) {
-               var     attrs = {
+               var attrs = {
                                foo: 'bar',
                                'class': 'lorem'
                        },
index d75c378..140da38 100644 (file)
@@ -4,7 +4,7 @@
        QUnit.test( 'devicePixelRatio', function ( assert ) {
                var devicePixelRatio = $.devicePixelRatio();
                assert.equal( typeof devicePixelRatio, 'number', '$.devicePixelRatio() returns a number' );
-       });
+       } );
 
        QUnit.test( 'matchSrcSet', function ( assert ) {
                var srcset = 'onefive.png 1.5x, two.png 2x';
@@ -18,5 +18,5 @@
                assert.equal( $.matchSrcSet( 1.25, srcset ), null, '1.25 gives no match' );
                assert.equal( $.matchSrcSet( 1.75, srcset ), 'onefive.png', '1.75 gives match to 1.5' );
                assert.equal( $.matchSrcSet( 2.25, srcset ), 'two.png', '2.25 gives match to 2' );
-       });
+       } );
 }( jQuery ) );
index 3810a04..d3877e0 100644 (file)
                assert.strictEqual( $lc.length, 1, 'link is created' );
                assert.strictEqual( $lc.text(), 'link', 'the link text got added' );
        } );
-}( jQuery, mediaWiki ) ) ;
+}( jQuery, mediaWiki ) );
index ec7179e..2bed9b9 100644 (file)
@@ -23,6 +23,6 @@
                                assert.equal( $res.find( 'b' ).text(), 'Hello world', 'Bold tag wraps the entire, same, text' );
 
                                QUnit.start();
-                       });
-       });
+                       } );
+       } );
 }( mediaWiki, jQuery ) );
index 869ebe4..7cfa46a 100644 (file)
@@ -1,6 +1,6 @@
 ( function ( mw, $ ) {
 
-       QUnit.module( 'mediawiki.language', QUnit.newMwEnvironment({
+       QUnit.module( 'mediawiki.language', QUnit.newMwEnvironment( {
                setup: function () {
                        this.liveLangData = mw.language.data.values;
                        mw.language.data.values = $.extend( true, {}, this.liveLangData );
@@ -8,12 +8,12 @@
                teardown: function () {
                        mw.language.data.values = this.liveLangData;
                }
-       }) );
+       } ) );
 
        QUnit.test( 'mw.language getData and setData', 2, function ( assert ) {
                mw.language.setData( 'en', 'testkey', 'testvalue' );
-               assert.equal(  mw.language.getData( 'en', 'testkey' ), 'testvalue', 'Getter setter test for mw.language' );
-               assert.equal(  mw.language.getData( 'en', 'invalidkey' ), undefined, 'Getter setter test for mw.language with invalid key' );
+               assert.equal( mw.language.getData( 'en', 'testkey' ), 'testvalue', 'Getter setter test for mw.language' );
+               assert.equal( mw.language.getData( 'en', 'invalidkey' ), undefined, 'Getter setter test for mw.language with invalid key' );
        } );
 
        function grammarTest( langCode, test ) {
                QUnit.test( 'Grammar test for lang=' + langCode, function ( assert ) {
                        QUnit.expect( test.length );
 
-                       for ( var i = 0 ; i < test.length; i++ ) {
+                       for ( var i = 0; i < test.length; i++ ) {
                                assert.equal(
                                        mw.language.convertGrammar( test[i].word, test[i].grammarForm ),
                                        test[i].expected,
                                        test[i].description
                                );
                        }
-               });
+               } );
        }
 
        var grammarTests = {
                if ( langCode === mw.config.get( 'wgUserLanguage' ) ) {
                        grammarTest( langCode, test );
                }
-       });
+       } );
 }( mediaWiki, jQuery ) );
index 04cf8d8..0823275 100644 (file)
@@ -10,14 +10,15 @@ class SeleniumConfig {
         * See sample config file in selenium_settings.ini.sample
         *
         */
-
-       public static function getSeleniumSettings ( &$seleniumSettings,
-                       &$seleniumBrowsers,
-                       &$seleniumTestSuites,
-                       $seleniumConfigFile = null ) {
+       public static function getSeleniumSettings( &$seleniumSettings,
+                                                                                               &$seleniumBrowsers,
+                                                                                               &$seleniumTestSuites,
+                                                                                               $seleniumConfigFile = null ) {
                if ( strlen( $seleniumConfigFile ) == 0 ) {
                        global $wgSeleniumConfigFile;
-                       if ( isset( $wgSeleniumConfigFile ) ) $seleniumConfigFile =  $wgSeleniumConfigFile ;
+                       if ( isset( $wgSeleniumConfigFile ) ) {
+                               $seleniumConfigFile = $wgSeleniumConfigFile;
+                       }
                }
 
                if ( strlen( $seleniumConfigFile ) == 0 || !file_exists( $seleniumConfigFile ) ) {
@@ -29,7 +30,7 @@ class SeleniumConfig {
                        throw new MWException( "Error parsing " . $seleniumConfigFile . "\n" );
                }
 
-               if ( array_key_exists( 'SeleniumSettings', $configArray ) {
+               if ( array_key_exists( 'SeleniumSettings', $configArray ) ) {
                        wfSuppressWarnings();
                        //we may need to change how this is set. But for now leave it in the ini file
                        $seleniumBrowsers = $configArray['SeleniumSettings']['browsers'];
@@ -48,7 +49,7 @@ class SeleniumConfig {
 
                        wfRestoreWarnings();
                }
-               if ( array_key_exists( 'SeleniumTests', $configArray ) {
+               if ( array_key_exists( 'SeleniumTests', $configArray ) ) {
                        wfSuppressWarnings();
                        $seleniumTestSuites = $configArray['SeleniumTests']['testSuite'];
                        wfRestoreWarnings();
index 9436f67..dc0ac66 100644 (file)
@@ -14,20 +14,17 @@ class SeleniumTestListener implements PHPUnit_Framework_TestListener {
                $this->tests_failed++;
        }
 
-       public function addFailure( PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time )
-       {
+       public function addFailure( PHPUnit_Framework_Test $test, PHPUnit_Framework_AssertionFailedError $e, $time ) {
                $this->logger->write( 'Failed: ' . $e->getMessage() );
                $this->tests_failed++;
        }
 
-       public function addIncompleteTest( PHPUnit_Framework_Test $test, Exception $e, $time )
-       {
+       public function addIncompleteTest( PHPUnit_Framework_Test $test, Exception $e, $time ) {
                $this->logger->write( 'Incomplete.' );
                $this->tests_failed++;
        }
 
-       public function addSkippedTest( PHPUnit_Framework_Test $test, Exception $e, $time )
-       {
+       public function addSkippedTest( PHPUnit_Framework_Test $test, Exception $e, $time ) {
                $this->logger->write( 'Skipped.' );
                $this->tests_failed++;
        }
@@ -53,7 +50,7 @@ class SeleniumTestListener implements PHPUnit_Framework_TestListener {
        }
 
        public function endTestSuite( PHPUnit_Framework_TestSuite $suite ) {
-               $this->logger->write('Testsuite ' . $suite->getName() . ' ended.' );
+               $this->logger->write( 'Testsuite ' . $suite->getName() . ' ended.' );
                if ( $this->tests_ok > 0 || $this->tests_failed > 0 ) {
                        $this->logger->write( ' OK: ' . $this->tests_ok . ' Failed: ' . $this->tests_failed );
                }
index 81a630f..6cbc1c7 100644 (file)
@@ -25,7 +25,7 @@ abstract class SeleniumTestSuite extends PHPUnit_Framework_TestSuite {
                if ( $this->triggerClientTestResources ) {
                        $this->selenium->open( $this->selenium->getUrl() . '/index.php?setupTestSuite=' . $this->getName() );
                        //wait a little longer for the db operation
-                       $this->selenium->waitForPageToLoad( 6000  );
+                       $this->selenium->waitForPageToLoad( 6000 );
                }
                if ( $this->loginBeforeTests ) {
                        $this->login();
@@ -50,7 +50,7 @@ abstract class SeleniumTestSuite extends PHPUnit_Framework_TestSuite {
        protected function setLoginBeforeTests( $loginBeforeTests = true ) {
                $this->loginBeforeTests = $loginBeforeTests;
        }
-       
+
        protected function setTriggerClientTestResources( $triggerClientTestResources = true ) {
                $this->triggerClientTestResources = $triggerClientTestResources;
        }
index d86bcb8..2663f65 100644 (file)
@@ -33,9 +33,9 @@
  * with current value of the 'DB_NAME_PREFIX'.
  * If you wish to run the suite more than one time, you need to change
  * the value of the 'DB_NAME_PREFIX'.
-*/
-define('DB_NAME_PREFIX', "database_name" );
-define('DIRECTORY_NAME', "mediawiki" );
+ */
+define( 'DB_NAME_PREFIX', "database_name" );
+define( 'DIRECTORY_NAME', "mediawiki" );
 define( 'PORT', "8080" );
 define( 'HOST_NAME', "localhost" );
 
@@ -45,5 +45,5 @@ define( 'HOST_NAME', "localhost" );
  *  IE :  *iexplore
  *  Google chrome : *googlechrome
  *  Opera :  *opera
-*/
+ */
 define ( 'TEST_BROWSER', "*firefox" );
index a348b54..f63c2eb 100644 (file)
 // 'MySQL' database type help field hint
 define( 'MYSQL_DATABASE_HOST_HELP', "If your database server is on different server, enter the host name or IP address here. \nIf you are using shared web hosting, your hosting provider should give you the correct host name in their documentation. \nIf you are installing on a Windows server and using MySQL, using \"localhost\" may not work for the server name. If it does not, try \"127.0.0.1\" for the local IP address." );
 define( 'MYSQL_DATABASE_NAME_HELP', "Choose a name that identifies your wiki. It should not contain spaces or hyphens. \nIf you are using shared web hosting, your hosting provider will either give you a specific database name to use or let you create databases via a control panel." );
-define( 'MYSQL_DATABASE_TABLE_PREFIX_HELP', "Choose a name that identifies your wiki. It should not contain spaces or hyphens.");
+define( 'MYSQL_DATABASE_TABLE_PREFIX_HELP', "Choose a name that identifies your wiki. It should not contain spaces or hyphens." );
 define( 'MYSQL_DATBASE_USERNAME_HELP', "Enter the username that will be used to connect to the database during the installation process. This is not the username of the MediaWiki account; this is the username for your database." );
 define( 'MYSQL_DATABASE_PASSWORD_HELP', "Enter the password that will be used to connect to the database during the installation process. This is not the password for the MediaWiki account; this is the password for your database." );
 
 
 // 'SQLite' database type help field hint
 define( 'SQLITE_DATA_DIRECTORY_HELP', "SQLite stores all data in a single file. \nThe directory you provide must be writable by the webserver during installation. \nIt should not be accessible via the web, this is why we're not putting it where your PHP files are. \nThe installer will write a .htaccess file along with it, but if that fails someone can gain access to your raw database. That includes raw user data (e-mail addresses, hashed passwords) as well as deleted revisions and other restricted data on the wiki. \nConsider putting the database somewhere else altogether, for example in /var/lib/mediawiki/yourwiki." );
-define( 'SQLITE_DATABASE_NAME_HELP', "Choose a name that identifies your wiki. Do not use spaces or hyphens. This will be used for the SQLite data file name.");
+define( 'SQLITE_DATABASE_NAME_HELP', "Choose a name that identifies your wiki. Do not use spaces or hyphens. This will be used for the SQLite data file name." );
 
 
 // 'Database settings' page hel0p field hint
@@ -47,7 +47,7 @@ define( 'DATABASE_CHARACTER_SET_HELP', "In binary mode, MediaWiki stores UTF-8 t
 
 
 // 'Name' page help field hint
-define( 'NAME_OF_WIKI_HELP', "This will appear in the title bar of the browser and in various other places.");
+define( 'NAME_OF_WIKI_HELP', "This will appear in the title bar of the browser and in various other places." );
 define( 'PROJECT_NAMESPACE_HELP', "Following Wikipedia's example, many wikis keep their policy pages separate from their content pages, in a \"project namespace\". All page titles in this namespace start with a certain prefix, which you can specify here. Traditionally, this prefix is derived from the name of the wiki, but it cannot contain punctuation characters such as \"#\" or \":\"." );
 define( 'USER_NAME_HELP', "Enter your preferred username here, for example \"Joe Bloggs\". This is the name you will use to log in to the wiki." );
 define( 'EMAIL_ADDRESS_HELP', "Enter an e-mail address here to allow you to receive e-mail from other users on the wiki, reset your password, and be notified of changes to pages on your watchlist." );
index bb11d02..b271c7e 100644 (file)
 
 
 // Common variables
-define('PAGE_LOAD_TIME', "80000" );
+define( 'PAGE_LOAD_TIME', "80000" );
 
 // Common links
-define( 'LINK_DIV', "//div[@id='bodyContent']/div/div/");
+define( 'LINK_DIV', "//div[@id='bodyContent']/div/div/" );
 define( 'LINK_FORM', "//div[@id='bodyContent']/div/div/div[2]/form/" );
-define( 'LINK_RIGHT_FRAMEWORK', "//div[@id='bodyContent']/div/div/div[1]/ul[1]/");
+define( 'LINK_RIGHT_FRAMEWORK', "//div[@id='bodyContent']/div/div/div[1]/ul[1]/" );
 
 // 'Name' page input values
 define( 'NAME_OF_WIKI', "Site Name" );
@@ -48,30 +48,30 @@ define ( 'ADMIN_EMAIL_ADDRESS', "admin@example.com" );
 define( 'VALID_WIKI_NAME', "MyWiki" );
 define( 'VALID_YOUR_NAME', "FirstName LastName" );
 define( 'VALID_PASSWORD', "12345" );
-define( 'VALID_PASSWORD_AGAIN', "12345"  );
+define( 'VALID_PASSWORD_AGAIN', "12345" );
 define( 'INVALID_PASSWORD_AGAIN', "123" );
-define( 'VALID_NAMESPACE', "Mynamespace"  );
+define( 'VALID_NAMESPACE', "Mynamespace" );
 define( 'INVALID_NAMESPACE', "##..##" );
 
 
 // 'Database settings' page input values
 define( 'DB_WEB_USER', "different" );
-define('DB_WEB_USER_PASSWORD', "12345" );
+define( 'DB_WEB_USER_PASSWORD', "12345" );
 
 
 // 'Connet to database' page input values
-define( 'DATABASE_PREFIX',"databaseprefix" );
+define( 'DATABASE_PREFIX', "databaseprefix" );
 
 
 // 'Connet to database' page input values for warning messages
 define( 'VALID_DB_HOST', "localhost" );
 define( 'INVALID_DB_HOST', "local" );
 define( 'INVALID_DB_NAME', "my-wiki" );
-define( 'VALID_DB_NAME', "my_wiki1");
+define( 'VALID_DB_NAME', "my_wiki1" );
 define( 'INVALID_DB_PREFIX', "database prefix" );
-define( 'VALID_DB_PREFIX', "database_prefix");
+define( 'VALID_DB_PREFIX', "database_prefix" );
 define( 'INVALID_DB_USER_NAME', "roots" );
-define( 'VALID_DB_USER_NAME', "root");
+define( 'VALID_DB_USER_NAME', "root" );
 define( 'INVALID_DB_PASSWORD', "12345" );
 
 
index 58ccc7c..03ffbfd 100644 (file)
@@ -44,10 +44,7 @@ require_once ( __DIR__ . '/MediaWikiDifferntDatabasePrefixTestCase.php' );
 require_once ( __DIR__ . '/MediaWikiDifferentDatabaseAccountTestCase.php' );
 require_once ( __DIR__ . '/MediaWikiOnAlreadyInstalledTestCase.php' );
 
-
-
-
-$suite = new PHPUnit_Framework_TestSuite('ArrayTest');
+$suite = new PHPUnit_Framework_TestSuite( 'ArrayTest' );
 $result = new PHPUnit_Framework_TestResult;
 
-$suite->run($result);
+$suite->run( $result );
index 072c3cb..aeb2315 100644 (file)
@@ -6,7 +6,7 @@
  * @file
  * @ingroup Testing
  * Copyright (C) 2010 Nadeesha Weerasinghe <nadeesha@calcey.com>
- * http://www.calcey.com/ 
+ * http://www.calcey.com/
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  */
 
 class MediaWikiEditorConfig {
-
-    public static function getSettings(&$includeFiles, &$globalConfigs) {
-        $includes = array(
-                //files that needed to be included would go here
-                //commenting out because this does not exist
-                //'tests/selenium/suites/MediaWikiCommonFunction.php'
-        );
-        $configs = array(
-                'wgPageLoadTime' => "600000"
-        );
-        $includeFiles = array_merge( $includeFiles, $includes );
-        $globalConfigs = array_merge( $globalConfigs, $configs);
-        return true;
-    }
+       public static function getSettings( &$includeFiles, &$globalConfigs ) {
+               $includes = array(
+                       //files that needed to be included would go here
+                       //commenting out because this does not exist
+                       //'tests/selenium/suites/MediaWikiCommonFunction.php'
+               );
+               $configs = array(
+                       'wgPageLoadTime' => "600000"
+               );
+               $includeFiles = array_merge( $includeFiles, $includes );
+               $globalConfigs = array_merge( $globalConfigs, $configs );
+               return true;
+       }
 }
 
-
-
index 5cd0a34..8993907 100644 (file)
@@ -5,6 +5,7 @@ class MediaWikiExtraTestSuite extends SeleniumTestSuite {
                $this->setLoginBeforeTests( true );
                parent::setUp();
        }
+
        public function addTests() {
                $testFiles = array(
                        'tests/selenium/suites/MyContributionsTestCase.php',
index 6b8fc97..4491afd 100644 (file)
@@ -50,7 +50,8 @@ class MediawikiCoreSmokeTestCase extends SeleniumTestCase {
                $this->waitForPageToLoad( 30000 );
 
                $this->assertSeleniumHTMLContains(
-                               '//h1[@class="firstHeading"]', "Wikipedia-logo-v2-de.png" );
+                       '//h1[@class="firstHeading"]', "Wikipedia-logo-v2-de.png"
+               );
 
                /*
                $this->open( $this->getUrl() . '/index.php?title=Image:'
index a9a9b4d..fc69e3c 100644 (file)
@@ -2,12 +2,12 @@
 /**
  * Stubs for now. We're going to start populating this test.
  */
-class MediawikiCoreSmokeTestSuite extends SeleniumTestSuite
-{
+class MediawikiCoreSmokeTestSuite extends SeleniumTestSuite {
        public function setUp() {
                $this->setLoginBeforeTests( false );
                parent::setUp();
-       } 
+       }
+
        public function addTests() {
                $testFiles = array(
                        'tests/selenium/suites/MediawikiCoreSmokeTestCase.php'
index 256e354..e43ffa8 100644 (file)
@@ -1,16 +1,15 @@
 <?php
 
 class PageDeleteTestSuite extends SeleniumTestSuite {
-    public function setUp() {
-        $this->setLoginBeforeTests( true );
-        parent::setUp();
-    }
-    public function addTests() {
-        $testFiles = array(
-                'tests/selenium/suites/DeletePageAdminTestCase.php'
-        );
-        parent::addTestFiles( $testFiles );
-    }
-
+       public function setUp() {
+               $this->setLoginBeforeTests( true );
+               parent::setUp();
+       }
 
+       public function addTests() {
+               $testFiles = array(
+                       'tests/selenium/suites/DeletePageAdminTestCase.php'
+               );
+               parent::addTestFiles( $testFiles );
+       }
 }
index b87172e..14c9e6b 100644 (file)
@@ -24,7 +24,7 @@ class SimpleSeleniumTestCase extends SeleniumTestCase {
        public function testGlobalVariableForDefaultSkin() {
                $this->open( $this->getUrl() . '/index.php' );
                $bodyClass = $this->getAttribute( "//body/@class" );
-               $this-> assertContains('skin-chick', $bodyClass, 'Chick skin not set');
+               $this->assertContains( 'skin-chick', $bodyClass, 'Chick skin not set' );
        }
 
        /**
@@ -33,7 +33,7 @@ class SimpleSeleniumTestCase extends SeleniumTestCase {
        public function testDatabaseResourceLoadedCorrectly() {
                $this->open( $this->getUrl() . '/index.php/TestResources?action=purge' );
                $testString = $this->gettext( "//body//*[@id='firstHeading']" );
-               $this-> assertEquals('TestResources', $testString, 'Article that should be present in the test db was not found.');
+               $this->assertEquals( 'TestResources', $testString, 'Article that should be present in the test db was not found.' );
        }
 
 }
index 2e0c4ee..446836a 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Sample test suite. 
+ * Sample test suite.
  * Two ways to configure MW for these tests
  * 1) If you are running multiple test suites, add the following in LocalSettings.php
  * require_once("tests/selenium/SimpleSeleniumConfig.php");
@@ -9,12 +9,12 @@
  * 2) Add the following to your Localsettings.php
  * $wgDefaultSkin = 'chick';
  */
-class SimpleSeleniumTestSuite extends SeleniumTestSuite
-{
+class SimpleSeleniumTestSuite extends SeleniumTestSuite {
        public function setUp() {
                $this->setLoginBeforeTests( false );
                parent::setUp();
-       } 
+       }
+
        public function addTests() {
                $testFiles = array(
                        'selenium/suites/SimpleSeleniumTestCase.php'