Update formatting
authorSiebrand Mazeland <s.mazeland@xs4all.nl>
Thu, 14 Feb 2013 13:10:38 +0000 (14:10 +0100)
committerSiebrand Mazeland <s.mazeland@xs4all.nl>
Thu, 14 Feb 2013 13:10:38 +0000 (14:10 +0100)
4 of n.

Change-Id: I23e2409ce9eff14c3434154d236de83c93a92440

19 files changed:
tests/phpunit/includes/api/ApiWatchTest.php
tests/phpunit/includes/api/RandomImageGenerator.php
tests/phpunit/includes/api/format/ApiFormatTestBase.php
tests/phpunit/includes/api/generateRandomImages.php
tests/phpunit/includes/api/query/ApiQueryBasicTest.php
tests/phpunit/includes/api/query/ApiQueryRevisionsTest.php
tests/phpunit/includes/api/query/ApiQueryTest.php
tests/phpunit/includes/cache/GenderCacheTest.php
tests/phpunit/includes/cache/ProcessCacheLRUTest.php
tests/phpunit/includes/content/ContentHandlerTest.php
tests/phpunit/includes/content/CssContentTest.php
tests/phpunit/includes/content/JavaScriptContentTest.php
tests/phpunit/includes/content/TextContentTest.php
tests/phpunit/includes/content/WikitextContentHandlerTest.php
tests/phpunit/includes/content/WikitextContentTest.php
tests/phpunit/includes/db/DatabaseSQLTest.php
tests/phpunit/includes/db/DatabaseSqliteTest.php
tests/phpunit/includes/db/DatabaseTest.php
tests/phpunit/includes/debug/MWDebugTest.php

index 4fecec0..aefd939 100644 (file)
@@ -147,8 +147,8 @@ class ApiWatchTest extends ApiTestCase {
 
                        $this->assertArrayHasKey( 'rollback', $data[0] );
                        $this->assertArrayHasKey( 'title', $data[0]['rollback'] );
 
                        $this->assertArrayHasKey( 'rollback', $data[0] );
                        $this->assertArrayHasKey( 'title', $data[0]['rollback'] );
-               } catch( UsageException $ue ) {
-                       if( $ue->getCodeString() == 'onlyauthor' ) {
+               } catch ( UsageException $ue ) {
+                       if ( $ue->getCodeString() == 'onlyauthor' ) {
                                $this->markTestIncomplete( "Only one author to 'Help:UTPage', cannot test rollback" );
                        } else {
                                $this->fail( "Received error '" . $ue->getCodeString() . "'" );
                                $this->markTestIncomplete( "Only one author to 'Help:UTPage', cannot test rollback" );
                        } else {
                                $this->fail( "Received error '" . $ue->getCodeString() . "'" );
index 8b6a384..3040758 100644 (file)
 class RandomImageGenerator {
 
        private $dictionaryFile;
 class RandomImageGenerator {
 
        private $dictionaryFile;
-       private $minWidth     = 400 ;
-       private $maxWidth     = 800 ;
-       private $minHeight    = 400 ;
-       private $maxHeight    = 800 ;
-       private $shapesToDraw =   5 ;
+       private $minWidth = 400;
+       private $maxWidth = 800;
+       private $minHeight = 400;
+       private $maxHeight = 800;
+       private $shapesToDraw = 5;
 
        /**
         * Orientations: 0th row, 0th column, EXIF orientation code, rotation 2x2 matrix that is opposite of orientation
 
        /**
         * Orientations: 0th row, 0th column, EXIF orientation code, rotation 2x2 matrix that is opposite of orientation
@@ -76,11 +76,13 @@ class RandomImageGenerator {
 
                // find the dictionary file, to generate random names
                if ( !isset( $this->dictionaryFile ) ) {
 
                // find the dictionary file, to generate random names
                if ( !isset( $this->dictionaryFile ) ) {
-                       foreach ( array(
+                       foreach (
+                               array(
                                        '/usr/share/dict/words',
                                        '/usr/dict/words',
                                        '/usr/share/dict/words',
                                        '/usr/dict/words',
-                                       __DIR__ . '/words.txt' )
-                                       as $dictionaryFile ) {
+                                       __DIR__ . '/words.txt'
+                               ) as $dictionaryFile
+                       ) {
                                if ( is_file( $dictionaryFile ) and is_readable( $dictionaryFile ) ) {
                                        $this->dictionaryFile = $dictionaryFile;
                                        break;
                                if ( is_file( $dictionaryFile ) and is_readable( $dictionaryFile ) ) {
                                        $this->dictionaryFile = $dictionaryFile;
                                        break;
@@ -103,7 +105,7 @@ class RandomImageGenerator {
        function writeImages( $number, $format = 'jpg', $dir = null ) {
                $filenames = $this->getRandomFilenames( $number, $format, $dir );
                $imageWriteMethod = $this->getImageWriteMethod( $format );
        function writeImages( $number, $format = 'jpg', $dir = null ) {
                $filenames = $this->getRandomFilenames( $number, $format, $dir );
                $imageWriteMethod = $this->getImageWriteMethod( $format );
-               foreach( $filenames as $filename ) {
+               foreach ( $filenames as $filename ) {
                        $this->{$imageWriteMethod}( $this->getImageSpec(), $format, $filename );
                }
                return $filenames;
                        $this->{$imageWriteMethod}( $this->getImageSpec(), $format, $filename );
                }
                return $filenames;
@@ -144,7 +146,7 @@ class RandomImageGenerator {
                        $dir = getcwd();
                }
                $filenames = array();
                        $dir = getcwd();
                }
                $filenames = array();
-               foreach( $this->getRandomWordPairs( $number ) as $pair ) {
+               foreach ( $this->getRandomWordPairs( $number ) as $pair ) {
                        $basename = $pair[0] . '_' . $pair[1];
                        if ( !is_null( $extension ) ) {
                                $basename .= '.' . $extension;
                        $basename = $pair[0] . '_' . $pair[1];
                        if ( !is_null( $extension ) ) {
                                $basename .= '.' . $extension;
@@ -181,17 +183,17 @@ class RandomImageGenerator {
                        }
                        $originX = mt_rand( -1 * $radius, $spec['width'] + $radius );
                        $originY = mt_rand( -1 * $radius, $spec['height'] + $radius );
                        }
                        $originX = mt_rand( -1 * $radius, $spec['width'] + $radius );
                        $originY = mt_rand( -1 * $radius, $spec['height'] + $radius );
-                       $angle = mt_rand( 0, ( 3.141592/2 ) * $radius ) / $radius;
+                       $angle = mt_rand( 0, ( 3.141592 / 2 ) * $radius ) / $radius;
                        $legDeltaX = round( $radius * sin( $angle ) );
                        $legDeltaY = round( $radius * cos( $angle ) );
 
                        $draw = array();
                        $draw['fill'] = $this->getRandomColor();
                        $draw['shape'] = array(
                        $legDeltaX = round( $radius * sin( $angle ) );
                        $legDeltaY = round( $radius * cos( $angle ) );
 
                        $draw = array();
                        $draw['fill'] = $this->getRandomColor();
                        $draw['shape'] = array(
-                               array( 'x' => $originX,                 'y' => $originY - $radius ),
-                               array( 'x' => $originX + $legDeltaX,    'y' => $originY + $legDeltaY ),
-                               array( 'x' => $originX - $legDeltaX,    'y' => $originY + $legDeltaY ),
-                               array( 'x' => $originX,                 'y' => $originY - $radius )
+                               array( 'x' => $originX, 'y' => $originY - $radius ),
+                               array( 'x' => $originX + $legDeltaX, 'y' => $originY + $legDeltaY ),
+                               array( 'x' => $originX - $legDeltaX, 'y' => $originY + $legDeltaY ),
+                               array( 'x' => $originX, 'y' => $originY - $radius )
                        );
                        $draws[] = $draw;
 
                        );
                        $draws[] = $draw;
 
@@ -235,12 +237,13 @@ class RandomImageGenerator {
                        $shape = $g->addChild( 'polygon' );
                        $shape->addAttribute( 'fill', $drawSpec['fill'] );
                        $shape->addAttribute( 'points', self::shapePointsToString( $drawSpec['shape'] ) );
                        $shape = $g->addChild( 'polygon' );
                        $shape->addAttribute( 'fill', $drawSpec['fill'] );
                        $shape->addAttribute( 'points', self::shapePointsToString( $drawSpec['shape'] ) );
-               };
-               if ( ! $fh = fopen( $filename, 'w' ) ) {
+               }
+
+               if ( !$fh = fopen( $filename, 'w' ) ) {
                        throw new Exception( "couldn't open $filename for writing" );
                }
                fwrite( $fh, $svg->asXML() );
                        throw new Exception( "couldn't open $filename for writing" );
                }
                fwrite( $fh, $svg->asXML() );
-               if ( !fclose($fh) ) {
+               if ( !fclose( $fh ) ) {
                        throw new Exception( "couldn't close $filename" );
                }
        }
                        throw new Exception( "couldn't close $filename" );
                }
        }
@@ -262,7 +265,7 @@ class RandomImageGenerator {
                 */
                $orientation = self::$orientations[0]; // default is normal orientation
                if ( $format == 'jpg' ) {
                 */
                $orientation = self::$orientations[0]; // default is normal orientation
                if ( $format == 'jpg' ) {
-                       $orientation = self::$orientations[ array_rand( self::$orientations ) ];
+                       $orientation = self::$orientations[array_rand( self::$orientations )];
                        $spec = self::rotateImageSpec( $spec, $orientation['counterRotation'] );
                }
 
                        $spec = self::rotateImageSpec( $spec, $orientation['counterRotation'] );
                }
 
@@ -321,12 +324,12 @@ class RandomImageGenerator {
                $tSpec['height'] = abs( $dims['y'] );
                $tSpec['fill'] = $spec['fill'];
                $tSpec['draws'] = array();
                $tSpec['height'] = abs( $dims['y'] );
                $tSpec['fill'] = $spec['fill'];
                $tSpec['draws'] = array();
-               foreach( $spec['draws'] as $draw ) {
+               foreach ( $spec['draws'] as $draw ) {
                        $tDraw = array(
                                'fill' => $draw['fill'],
                                'shape' => array()
                        );
                        $tDraw = array(
                                'fill' => $draw['fill'],
                                'shape' => array()
                        );
-                       foreach( $draw['shape'] as $point ) {
+                       foreach ( $draw['shape'] as $point ) {
                                $tPoint = self::matrixMultiply2x2( $matrix, $point['x'], $point['y'] );
                                $tPoint['x'] += $correctionX;
                                $tPoint['y'] += $correctionY;
                                $tPoint = self::matrixMultiply2x2( $matrix, $point['x'], $point['y'] );
                                $tPoint['x'] += $correctionX;
                                $tPoint['y'] += $correctionY;
@@ -357,7 +360,7 @@ class RandomImageGenerator {
         *
         * Sample command line:
         *  $ convert -size 100x60 xc:rgb(90,87,45) \
         *
         * Sample command line:
         *  $ convert -size 100x60 xc:rgb(90,87,45) \
-        *       -draw 'fill rgb(12,34,56)   polygon 41,39 44,57 50,57 41,39' \
+        *      -draw 'fill rgb(12,34,56)   polygon 41,39 44,57 50,57 41,39' \
         *   -draw 'fill rgb(99,123,231) circle 59,39 56,57' \
         *   -draw 'fill rgb(240,12,32)  circle 50,21 50,3'  filename.png
         *
         *   -draw 'fill rgb(99,123,231) circle 59,39 56,57' \
         *   -draw 'fill rgb(240,12,32)  circle 50,21 50,3'  filename.png
         *
@@ -370,7 +373,7 @@ class RandomImageGenerator {
                $args = array();
                $args[] = "-size " . wfEscapeShellArg( $spec['width'] . 'x' . $spec['height'] );
                $args[] = wfEscapeShellArg( "xc:" . $spec['fill'] );
                $args = array();
                $args[] = "-size " . wfEscapeShellArg( $spec['width'] . 'x' . $spec['height'] );
                $args[] = wfEscapeShellArg( "xc:" . $spec['fill'] );
-               foreach( $spec['draws'] as $draw ) {
+               foreach ( $spec['draws'] as $draw ) {
                        $fill = $draw['fill'];
                        $polygon = self::shapePointsToString( $draw['shape'] );
                        $drawCommand = "fill $fill  polygon $polygon";
                        $fill = $draw['fill'];
                        $polygon = self::shapePointsToString( $draw['shape'] );
                        $drawCommand = "fill $fill  polygon $polygon";
@@ -391,10 +394,10 @@ class RandomImageGenerator {
         */
        public function getRandomColor() {
                $components = array();
         */
        public function getRandomColor() {
                $components = array();
-               for ($i = 0; $i <= 2; $i++ ) {
+               for ( $i = 0; $i <= 2; $i++ ) {
                        $components[] = mt_rand( 0, 255 );
                }
                        $components[] = mt_rand( 0, 255 );
                }
-               return 'rgb(' . join(', ', $components) . ')';
+               return 'rgb(' . join( ', ', $components ) . ')';
        }
 
        /**
        }
 
        /**
@@ -408,13 +411,12 @@ class RandomImageGenerator {
                // construct pairs of words
                $pairs = array();
                $count = count( $lines );
                // construct pairs of words
                $pairs = array();
                $count = count( $lines );
-               for( $i = 0; $i < $count; $i += 2 )  {
-                       $pairs[] = array( $lines[$i], $lines[$i+1] );
+               for ( $i = 0; $i < $count; $i += 2 ) {
+                       $pairs[] = array( $lines[$i], $lines[$i + 1] );
                }
                return $pairs;
        }
 
                }
                return $pairs;
        }
 
-
        /**
         * Return N random lines from a file
         *
        /**
         * Return N random lines from a file
         *
@@ -438,17 +440,17 @@ class RandomImageGenerator {
                 */
                $fh = fopen( $filepath, "r" );
                if ( !$fh ) {
                 */
                $fh = fopen( $filepath, "r" );
                if ( !$fh ) {
-                        throw new Exception( "couldn't open $filepath" );
+                       throw new Exception( "couldn't open $filepath" );
                }
                $line_number = 0;
                $max_index = $number_desired - 1;
                }
                $line_number = 0;
                $max_index = $number_desired - 1;
-               while( !feof( $fh ) ) {
+               while ( !feof( $fh ) ) {
                        $line = fgets( $fh );
                        if ( $line !== false ) {
                                $line_number++;
                                $line = trim( $line );
                                if ( mt_rand( 0, $line_number ) <= $max_index ) {
                        $line = fgets( $fh );
                        if ( $line !== false ) {
                                $line_number++;
                                $line = trim( $line );
                                if ( mt_rand( 0, $line_number ) <= $max_index ) {
-                                       $lines[ mt_rand( 0, $max_index ) ] = $line;
+                                       $lines[mt_rand( 0, $max_index )] = $line;
                                }
                        }
                }
                                }
                        }
                }
index a0b7b02..153f2cf 100644 (file)
@@ -5,7 +5,7 @@ abstract class ApiFormatTestBase extends ApiTestCase {
                $data = parent::doApiRequest( $params, $data, true );
 
                $module = $data[3];
                $data = parent::doApiRequest( $params, $data, true );
 
                $module = $data[3];
-               
+
                $printer = $module->createPrinterByName( $format );
                $printer->setUnescapeAmps( false );
 
                $printer = $module->createPrinterByName( $format );
                $printer->setUnescapeAmps( false );
 
@@ -14,7 +14,7 @@ abstract class ApiFormatTestBase extends ApiTestCase {
                ob_start();
                $printer->execute();
                $out = ob_get_clean();
                ob_start();
                $printer->execute();
                $out = ob_get_clean();
-               
+
                $printer->closePrinter();
 
                return $out;
                $printer->closePrinter();
 
                return $out;
index a054283..cba8312 100644 (file)
@@ -10,7 +10,7 @@ $IP = dirname( dirname( dirname( dirname( __DIR__ ) ) ) );
 
 // Start up MediaWiki in command-line mode
 require_once( "$IP/maintenance/Maintenance.php" );
 
 // Start up MediaWiki in command-line mode
 require_once( "$IP/maintenance/Maintenance.php" );
-require(  __DIR__ . "/RandomImageGenerator.php" );
+require( __DIR__ . "/RandomImageGenerator.php" );
 
 class GenerateRandomImages extends Maintenance {
 
 
 class GenerateRandomImages extends Maintenance {
 
index b7dac06..a5ca256 100644 (file)
@@ -30,7 +30,6 @@
  * @group medium
  */
 class ApiQueryBasicTest extends ApiTestCase {
  * @group medium
  */
 class ApiQueryBasicTest extends ApiTestCase {
-
        /**
         * Create a set of pages. These must not change, otherwise the tests might give wrong results.
         * @see MediaWikiTestCase::addDBData()
        /**
         * Create a set of pages. These must not change, otherwise the tests might give wrong results.
         * @see MediaWikiTestCase::addDBData()
@@ -304,7 +303,7 @@ class ApiQueryBasicTest extends ApiTestCase {
        private function merge( /*...*/ ) {
                $request = array();
                $expected = array();
        private function merge( /*...*/ ) {
                $request = array();
                $expected = array();
-               foreach ( func_get_args() as $v ) {
+               foreach ( func_get_args() as $v ) {
                        $request = array_merge_recursive( $request, $v[0] );
                        $this->mergeExpected( $expected, $v[1] );
                }
                        $request = array_merge_recursive( $request, $v[0] );
                        $this->mergeExpected( $expected, $v[1] );
                }
@@ -317,7 +316,7 @@ class ApiQueryBasicTest extends ApiTestCase {
        private function mergeExpected( &$all, $item ) {
                foreach ( $item as $k => $v ) {
                        if ( array_key_exists( $k, $all ) ) {
        private function mergeExpected( &$all, $item ) {
                foreach ( $item as $k => $v ) {
                        if ( array_key_exists( $k, $all ) ) {
-                               if ( is_array ( $all[$k] ) ) {
+                               if ( is_array( $all[$k] ) ) {
                                        $this->mergeExpected( $all[$k], $v );
                                } else {
                                        $this->assertEquals( $all[$k], $v );
                                        $this->mergeExpected( $all[$k], $v );
                                } else {
                                        $this->assertEquals( $all[$k], $v );
@@ -349,12 +348,12 @@ class ApiQueryBasicTest extends ApiTestCase {
                $expected = array( 'query' => $expected );
                try {
                        $this->assertQueryResults( $expected, $result );
                $expected = array( 'query' => $expected );
                try {
                        $this->assertQueryResults( $expected, $result );
-               } catch (Exception $e) {
-                       print("\nRequest:\n");
+               } catch ( Exception $e ) {
+                       print( "\nRequest:\n" );
                        print_r( $request );
                        print_r( $request );
-                       print("\nExpected:\n");
+                       print( "\nExpected:\n" );
                        print_r( $expected );
                        print_r( $expected );
-                       print("\nResult:\n");
+                       print( "\nResult:\n" );
                        print_r( $result );
                        throw $e; // rethrow it
                }
                        print_r( $result );
                        throw $e; // rethrow it
                }
index 594dc66..7f5fe91 100644 (file)
@@ -11,8 +11,7 @@ class ApiQueryRevisionsTest extends ApiTestCase {
         * @group medium
         */
        function testContentComesWithContentModelAndFormat() {
         * @group medium
         */
        function testContentComesWithContentModelAndFormat() {
-
-               $pageName = 'Help:' . __METHOD__ ;
+               $pageName = 'Help:' . __METHOD__;
                $title = Title::newFromText( $pageName );
                $page = WikiPage::factory( $title );
                $page->doEdit( 'Some text', 'inserting content' );
                $title = Title::newFromText( $pageName );
                $page = WikiPage::factory( $title );
                $page->doEdit( 'Some text', 'inserting content' );
@@ -25,9 +24,9 @@ class ApiQueryRevisionsTest extends ApiTestCase {
                ) );
                $this->assertArrayHasKey( 'query', $apiResult[0] );
                $this->assertArrayHasKey( 'pages', $apiResult[0]['query'] );
                ) );
                $this->assertArrayHasKey( 'query', $apiResult[0] );
                $this->assertArrayHasKey( 'pages', $apiResult[0]['query'] );
-               foreach( $apiResult[0]['query']['pages'] as $page ) {
+               foreach ( $apiResult[0]['query']['pages'] as $page ) {
                        $this->assertArrayHasKey( 'revisions', $page );
                        $this->assertArrayHasKey( 'revisions', $page );
-                       foreach( $page['revisions'] as $revision ) {
+                       foreach ( $page['revisions'] as $revision ) {
                                $this->assertArrayHasKey( 'contentformat', $revision,
                                        'contentformat should be included when asking content so client knows how to interpret it'
                                );
                                $this->assertArrayHasKey( 'contentformat', $revision,
                                        'contentformat should be included when asking content so client knows how to interpret it'
                                );
index 1b1886e..7fb5307 100644 (file)
@@ -25,7 +25,7 @@ class ApiQueryTest extends ApiTestCase {
                $this->assertArrayHasKey( 'normalized', $data[0]['query'] );
 
                // Forge a normalized title
                $this->assertArrayHasKey( 'normalized', $data[0]['query'] );
 
                // Forge a normalized title
-               $to = Title::newFromText( $wgMetaNamespace.':ArticleA' );
+               $to = Title::newFromText( $wgMetaNamespace . ':ArticleA' );
 
                $this->assertEquals(
                        array(
 
                $this->assertEquals(
                        array(
@@ -47,7 +47,7 @@ class ApiQueryTest extends ApiTestCase {
 
        function testTitlesAreRejectedIfInvalid() {
                $title = false;
 
        function testTitlesAreRejectedIfInvalid() {
                $title = false;
-               while( !$title || Title::newFromText( $title )->exists() ) {
+               while ( !$title || Title::newFromText( $title )->exists() ) {
                        $title = md5( mt_rand( 0, 10000 ) + rand( 0, 999000 ) );
                }
 
                        $title = md5( mt_rand( 0, 10000 ) + rand( 0, 999000 ) );
                }
 
index 52cdc78..ee3db3e 100644 (file)
@@ -15,7 +15,7 @@ class GenderCacheTest extends MediaWikiLangTestCase {
 
        function addDBData() {
                $user = User::newFromName( 'UTMale' );
 
        function addDBData() {
                $user = User::newFromName( 'UTMale' );
-               if( $user->getID() == 0 ) {
+               if ( $user->getID() == 0 ) {
                        $user->addToDatabase();
                        $user->setPassword( 'UTMalePassword' );
                }
                        $user->addToDatabase();
                        $user->setPassword( 'UTMalePassword' );
                }
@@ -24,7 +24,7 @@ class GenderCacheTest extends MediaWikiLangTestCase {
                $user->saveSettings();
 
                $user = User::newFromName( 'UTFemale' );
                $user->saveSettings();
 
                $user = User::newFromName( 'UTFemale' );
-               if( $user->getID() == 0 ) {
+               if ( $user->getID() == 0 ) {
                        $user->addToDatabase();
                        $user->setPassword( 'UTFemalePassword' );
                }
                        $user->addToDatabase();
                        $user->setPassword( 'UTFemalePassword' );
                }
@@ -33,7 +33,7 @@ class GenderCacheTest extends MediaWikiLangTestCase {
                $user->saveSettings();
 
                $user = User::newFromName( 'UTDefaultGender' );
                $user->saveSettings();
 
                $user = User::newFromName( 'UTDefaultGender' );
-               if( $user->getID() == 0 ) {
+               if ( $user->getID() == 0 ) {
                        $user->addToDatabase();
                        $user->setPassword( 'UTDefaultGenderPassword' );
                }
                        $user->addToDatabase();
                        $user->setPassword( 'UTDefaultGenderPassword' );
                }
index 1c081b8..c7e75d9 100644 (file)
@@ -24,7 +24,7 @@ class ProcessCacheLRUTest extends MediaWikiTestCase {
         */
        function fillCache( &$cache, $numEntries ) {
                // Fill cache with three values
         */
        function fillCache( &$cache, $numEntries ) {
                // Fill cache with three values
-               for( $i=1; $i<=$numEntries; $i++) {
+               for ( $i = 1; $i <= $numEntries; $i++ ) {
                        $cache->set( "cache-key-$i", "prop-$i", "value-$i" );
                }
        }
                        $cache->set( "cache-key-$i", "prop-$i", "value-$i" );
                }
        }
@@ -36,10 +36,10 @@ class ProcessCacheLRUTest extends MediaWikiTestCase {
        function getExpectedCache( $cacheMaxEntries, $entryToFill ) {
                $expected = array();
 
        function getExpectedCache( $cacheMaxEntries, $entryToFill ) {
                $expected = array();
 
-               if( $entryToFill === 0 ) {
+               if ( $entryToFill === 0 ) {
                        # The cache is empty!
                        return array();
                        # The cache is empty!
                        return array();
-               } elseif( $entryToFill <= $cacheMaxEntries ) {
+               } elseif ( $entryToFill <= $cacheMaxEntries ) {
                        # Cache is not fully filled
                        $firstKey = 1;
                } else {
                        # Cache is not fully filled
                        $firstKey = 1;
                } else {
@@ -47,9 +47,9 @@ class ProcessCacheLRUTest extends MediaWikiTestCase {
                        $firstKey = 1 + $entryToFill - $cacheMaxEntries;
                }
 
                        $firstKey = 1 + $entryToFill - $cacheMaxEntries;
                }
 
-               $lastKey  = $entryToFill;
+               $lastKey = $entryToFill;
 
 
-               for( $i=$firstKey; $i<=$lastKey; $i++ ) {
+               for ( $i = $firstKey; $i <= $lastKey; $i++ ) {
                        $expected["cache-key-$i"] = array( "prop-$i" => "value-$i" );
                }
                return $expected;
                        $expected["cache-key-$i"] = array( "prop-$i" => "value-$i" );
                }
                return $expected;
@@ -61,7 +61,7 @@ class ProcessCacheLRUTest extends MediaWikiTestCase {
        function testPhpUnitArrayEquality() {
                $one = array( 'A' => 1, 'B' => 2 );
                $two = array( 'B' => 2, 'A' => 1 );
        function testPhpUnitArrayEquality() {
                $one = array( 'A' => 1, 'B' => 2 );
                $two = array( 'B' => 2, 'A' => 1 );
-               $this->assertEquals( $one, $two );  // ==
+               $this->assertEquals( $one, $two ); // ==
                $this->assertNotSame( $one, $two ); // ===
        }
 
                $this->assertNotSame( $one, $two ); // ===
        }
 
@@ -118,7 +118,7 @@ class ProcessCacheLRUTest extends MediaWikiTestCase {
         */
        function testFillingCache( $cacheMaxEntries, $entryToFill, $msg = '' ) {
                $cache = new ProcessCacheLRUTestable( $cacheMaxEntries );
         */
        function testFillingCache( $cacheMaxEntries, $entryToFill, $msg = '' ) {
                $cache = new ProcessCacheLRUTestable( $cacheMaxEntries );
-               $this->fillCache( $cache, $entryToFill);
+               $this->fillCache( $cache, $entryToFill );
 
                $this->assertSame(
                        $this->getExpectedCache( $cacheMaxEntries, $entryToFill ),
 
                $this->assertSame(
                        $this->getExpectedCache( $cacheMaxEntries, $entryToFill ),
@@ -134,12 +134,11 @@ class ProcessCacheLRUTest extends MediaWikiTestCase {
        public static function provideCacheFilling() {
                // ($cacheMaxEntries, $entryToFill, $msg='')
                return array(
        public static function provideCacheFilling() {
                // ($cacheMaxEntries, $entryToFill, $msg='')
                return array(
-                       array( 1,  0 ),
-                       array( 1,  1 ),
-                       array( 1,  2 ), # overflow
+                       array( 1, 0 ),
+                       array( 1, 1 ),
+                       array( 1, 2 ), # overflow
                        array( 5, 33 ), # overflow
                );
                        array( 5, 33 ), # overflow
                );
-
        }
 
        /**
        }
 
        /**
@@ -167,7 +166,7 @@ class ProcessCacheLRUTest extends MediaWikiTestCase {
 
        function testRecentlyAccessedKeyStickIn() {
                $cache = new ProcessCacheLRUTestable( 2 );
 
        function testRecentlyAccessedKeyStickIn() {
                $cache = new ProcessCacheLRUTestable( 2 );
-               $cache->set( 'first' , 'prop1', 'value1' );
+               $cache->set( 'first', 'prop1', 'value1' );
                $cache->set( 'second', 'prop2', 'value2' );
 
                // Get first
                $cache->set( 'second', 'prop2', 'value2' );
 
                // Get first
@@ -233,6 +232,7 @@ class ProcessCacheLRUTestable extends ProcessCacheLRU {
        public function getCache() {
                return $this->cache;
        }
        public function getCache() {
                return $this->cache;
        }
+
        public function getEntriesCount() {
                return count( $this->cache );
        }
        public function getEntriesCount() {
                return count( $this->cache );
        }
index e12c8c7..19ceadd 100644 (file)
@@ -145,7 +145,7 @@ class ContentHandlerTest extends MediaWikiTestCase {
                $this->assertEquals( $expected->getCode(), $lang->getCode() );
        }
 
                $this->assertEquals( $expected->getCode(), $lang->getCode() );
        }
 
-       public function testGetContentText_Null( ) {
+       public function testGetContentText_Null() {
                global $wgContentHandlerTextFallback;
 
                $content = null;
                global $wgContentHandlerTextFallback;
 
                $content = null;
@@ -163,7 +163,7 @@ class ContentHandlerTest extends MediaWikiTestCase {
                $this->assertEquals( '', $text );
        }
 
                $this->assertEquals( '', $text );
        }
 
-       public function testGetContentText_TextContent( ) {
+       public function testGetContentText_TextContent() {
                global $wgContentHandlerTextFallback;
 
                $content = new WikitextContent( "hello world" );
                global $wgContentHandlerTextFallback;
 
                $content = new WikitextContent( "hello world" );
@@ -181,7 +181,7 @@ class ContentHandlerTest extends MediaWikiTestCase {
                $this->assertEquals( $content->getNativeData(), $text );
        }
 
                $this->assertEquals( $content->getNativeData(), $text );
        }
 
-       public function testGetContentText_NonTextContent( ) {
+       public function testGetContentText_NonTextContent() {
                global $wgContentHandlerTextFallback;
 
                $content = new DummyContentForTesting( "hello world" );
                global $wgContentHandlerTextFallback;
 
                $content = new DummyContentForTesting( "hello world" );
@@ -213,15 +213,15 @@ class ContentHandlerTest extends MediaWikiTestCase {
                return array(
                        array( 'hallo', 'Help:Test', null, null, CONTENT_MODEL_WIKITEXT, 'hallo', false ),
                        array( 'hallo', 'MediaWiki:Test.js', null, null, CONTENT_MODEL_JAVASCRIPT, 'hallo', false ),
                return array(
                        array( 'hallo', 'Help:Test', null, null, CONTENT_MODEL_WIKITEXT, 'hallo', false ),
                        array( 'hallo', 'MediaWiki:Test.js', null, null, CONTENT_MODEL_JAVASCRIPT, 'hallo', false ),
-                       array( serialize('hallo'), 'Dummy:Test', null, null, "testing", 'hallo', false ),
+                       array( serialize( 'hallo' ), 'Dummy:Test', null, null, "testing", 'hallo', false ),
 
                        array( 'hallo', 'Help:Test', null, CONTENT_FORMAT_WIKITEXT, CONTENT_MODEL_WIKITEXT, 'hallo', false ),
                        array( 'hallo', 'MediaWiki:Test.js', null, CONTENT_FORMAT_JAVASCRIPT, CONTENT_MODEL_JAVASCRIPT, 'hallo', false ),
 
                        array( 'hallo', 'Help:Test', null, CONTENT_FORMAT_WIKITEXT, CONTENT_MODEL_WIKITEXT, 'hallo', false ),
                        array( 'hallo', 'MediaWiki:Test.js', null, CONTENT_FORMAT_JAVASCRIPT, CONTENT_MODEL_JAVASCRIPT, 'hallo', false ),
-                       array( serialize('hallo'), 'Dummy:Test', null, "testing", "testing", 'hallo', false ),
+                       array( serialize( 'hallo' ), 'Dummy:Test', null, "testing", "testing", 'hallo', false ),
 
                        array( 'hallo', 'Help:Test', CONTENT_MODEL_CSS, null, CONTENT_MODEL_CSS, 'hallo', false ),
                        array( 'hallo', 'MediaWiki:Test.js', CONTENT_MODEL_CSS, null, CONTENT_MODEL_CSS, 'hallo', false ),
 
                        array( 'hallo', 'Help:Test', CONTENT_MODEL_CSS, null, CONTENT_MODEL_CSS, 'hallo', false ),
                        array( 'hallo', 'MediaWiki:Test.js', CONTENT_MODEL_CSS, null, CONTENT_MODEL_CSS, 'hallo', false ),
-                       array( serialize('hallo'), 'Dummy:Test', CONTENT_MODEL_CSS, null, CONTENT_MODEL_CSS, serialize('hallo'), false ),
+                       array( serialize( 'hallo' ), 'Dummy:Test', CONTENT_MODEL_CSS, null, CONTENT_MODEL_CSS, serialize( 'hallo' ), false ),
 
                        array( 'hallo', 'Help:Test', CONTENT_MODEL_WIKITEXT, "testing", null, null, true ),
                        array( 'hallo', 'MediaWiki:Test.js', CONTENT_MODEL_CSS, "testing", null, null, true ),
 
                        array( 'hallo', 'Help:Test', CONTENT_MODEL_WIKITEXT, "testing", null, null, true ),
                        array( 'hallo', 'MediaWiki:Test.js', CONTENT_MODEL_CSS, "testing", null, null, true ),
@@ -245,10 +245,14 @@ class ContentHandlerTest extends MediaWikiTestCase {
                        $this->assertEquals( $expectedModelId, $content->getModel(), 'bad model id' );
                        $this->assertEquals( $expectedNativeData, $content->getNativeData(), 'bads native data' );
                } catch ( MWException $ex ) {
                        $this->assertEquals( $expectedModelId, $content->getModel(), 'bad model id' );
                        $this->assertEquals( $expectedNativeData, $content->getNativeData(), 'bads native data' );
                } catch ( MWException $ex ) {
-                       if ( !$shouldFail ) $this->fail( "ContentHandler::makeContent failed unexpectedly: " . $ex->getMessage() );
-                       else $this->assertTrue( true ); // dummy, so we don't get the "test did not perform any assertions" message.
+                       if ( !$shouldFail ) {
+                               $this->fail( "ContentHandler::makeContent failed unexpectedly: " . $ex->getMessage() );
+                       }
+                       else {
+                               // dummy, so we don't get the "test did not perform any assertions" message.
+                               $this->assertTrue( true );
+                       }
                }
                }
-
        }
 
        /*
        }
 
        /*
@@ -292,7 +296,7 @@ class DummyContentHandlerForTesting extends ContentHandler {
         * @return String serialized form of the content
         */
        public function serializeContent( Content $content, $format = null ) {
         * @return String serialized form of the content
         */
        public function serializeContent( Content $content, $format = null ) {
-          return $content->serialize();
+               return $content->serialize();
        }
 
        /**
        }
 
        /**
index b08a468..8f53dd3 100644 (file)
@@ -62,7 +62,7 @@ class CssContentTest extends MediaWikiTestCase {
                $this->assertEquals( CONTENT_MODEL_CSS, $content->getContentHandler()->getModelID() );
        }
 
                $this->assertEquals( CONTENT_MODEL_CSS, $content->getContentHandler()->getModelID() );
        }
 
-       public static function dataEquals( ) {
+       public static function dataEquals() {
                return array(
                        array( new CssContent( 'hallo' ), null, false ),
                        array( new CssContent( 'hallo' ), new CssContent( 'hallo' ), true ),
                return array(
                        array( new CssContent( 'hallo' ), null, false ),
                        array( new CssContent( 'hallo' ), new CssContent( 'hallo' ), true ),
index 18df53f..2d693fe 100644 (file)
@@ -39,16 +39,16 @@ class JavaScriptContentTest extends TextContentTest {
        public static function dataGetSection() {
                return array(
                        array( WikitextContentTest::$sections,
        public static function dataGetSection() {
                return array(
                        array( WikitextContentTest::$sections,
-                              '0',
-                              null
+                               '0',
+                               null
                        ),
                        array( WikitextContentTest::$sections,
                        ),
                        array( WikitextContentTest::$sections,
-                              '2',
-                              null
+                               '2',
+                               null
                        ),
                        array( WikitextContentTest::$sections,
                        ),
                        array( WikitextContentTest::$sections,
-                              '8',
-                              null
+                               '8',
+                               null
                        ),
                );
        }
                        ),
                );
        }
@@ -57,39 +57,39 @@ class JavaScriptContentTest extends TextContentTest {
        public static function dataReplaceSection() {
                return array(
                        array( WikitextContentTest::$sections,
        public static function dataReplaceSection() {
                return array(
                        array( WikitextContentTest::$sections,
-                              '0',
-                              'No more',
-                              null,
-                              null
+                               '0',
+                               'No more',
+                               null,
+                               null
                        ),
                        array( WikitextContentTest::$sections,
                        ),
                        array( WikitextContentTest::$sections,
-                              '',
-                              'No more',
-                              null,
-                              null
+                               '',
+                               'No more',
+                               null,
+                               null
                        ),
                        array( WikitextContentTest::$sections,
                        ),
                        array( WikitextContentTest::$sections,
-                              '2',
-                              "== TEST ==\nmore fun",
-                              null,
-                              null
+                               '2',
+                               "== TEST ==\nmore fun",
+                               null,
+                               null
                        ),
                        array( WikitextContentTest::$sections,
                        ),
                        array( WikitextContentTest::$sections,
-                              '8',
-                              'No more',
-                              null,
-                              null
+                               '8',
+                               'No more',
+                               null,
+                               null
                        ),
                        array( WikitextContentTest::$sections,
                        ),
                        array( WikitextContentTest::$sections,
-                              'new',
-                              'No more',
-                              'New',
-                              null
+                               'new',
+                               'No more',
+                               'New',
+                               null
                        ),
                );
        }
 
                        ),
                );
        }
 
-       public function testAddSectionHeader( ) {
+       public function testAddSectionHeader() {
                $content = $this->newContent( 'hello world' );
                $c = $content->addSectionHeader( 'test' );
 
                $content = $this->newContent( 'hello world' );
                $c = $content->addSectionHeader( 'test' );
 
@@ -114,10 +114,10 @@ class JavaScriptContentTest extends TextContentTest {
        public static function dataPreloadTransform() {
                return array(
                        array( 'hello this is ~~~',
        public static function dataPreloadTransform() {
                return array(
                        array( 'hello this is ~~~',
-                              'hello this is ~~~',
+                               'hello this is ~~~',
                        ),
                        array( 'hello \'\'this\'\' is <noinclude>foo</noinclude><includeonly>bar</includeonly>',
                        ),
                        array( 'hello \'\'this\'\' is <noinclude>foo</noinclude><includeonly>bar</includeonly>',
-                              'hello \'\'this\'\' is <noinclude>foo</noinclude><includeonly>bar</includeonly>',
+                               'hello \'\'this\'\' is <noinclude>foo</noinclude><includeonly>bar</includeonly>',
                        ),
                );
        }
                        ),
                );
        }
@@ -125,13 +125,13 @@ class JavaScriptContentTest extends TextContentTest {
        public static function dataGetRedirectTarget() {
                return array(
                        array( '#REDIRECT [[Test]]',
        public static function dataGetRedirectTarget() {
                return array(
                        array( '#REDIRECT [[Test]]',
-                              null,
+                               null,
                        ),
                        array( '#REDIRECT Test',
                        ),
                        array( '#REDIRECT Test',
-                              null,
+                               null,
                        ),
                        array( '* #REDIRECT [[Test]]',
                        ),
                        array( '* #REDIRECT [[Test]]',
-                              null,
+                               null,
                        ),
                );
        }
                        ),
                );
        }
@@ -159,59 +159,59 @@ class JavaScriptContentTest extends TextContentTest {
        public static function dataIsCountable() {
                return array(
                        array( '',
        public static function dataIsCountable() {
                return array(
                        array( '',
-                              null,
-                              'any',
-                              true
+                               null,
+                               'any',
+                               true
                        ),
                        array( 'Foo',
                        ),
                        array( 'Foo',
-                              null,
-                              'any',
-                              true
+                               null,
+                               'any',
+                               true
                        ),
                        array( 'Foo',
                        ),
                        array( 'Foo',
-                              null,
-                              'comma',
-                              false
+                               null,
+                               'comma',
+                               false
                        ),
                        array( 'Foo, bar',
                        ),
                        array( 'Foo, bar',
-                              null,
-                              'comma',
-                              false
+                               null,
+                               'comma',
+                               false
                        ),
                        array( 'Foo',
                        ),
                        array( 'Foo',
-                              null,
-                              'link',
-                              false
+                               null,
+                               'link',
+                               false
                        ),
                        array( 'Foo [[bar]]',
                        ),
                        array( 'Foo [[bar]]',
-                              null,
-                              'link',
-                              false
+                               null,
+                               'link',
+                               false
                        ),
                        array( 'Foo',
                        ),
                        array( 'Foo',
-                              true,
-                              'link',
-                              false
+                               true,
+                               'link',
+                               false
                        ),
                        array( 'Foo [[bar]]',
                        ),
                        array( 'Foo [[bar]]',
-                              false,
-                              'link',
-                              false
+                               false,
+                               'link',
+                               false
                        ),
                        array( '#REDIRECT [[bar]]',
                        ),
                        array( '#REDIRECT [[bar]]',
-                              true,
-                              'any',
-                              true
+                               true,
+                               'any',
+                               true
                        ),
                        array( '#REDIRECT [[bar]]',
                        ),
                        array( '#REDIRECT [[bar]]',
-                              true,
-                              'comma',
-                              false
+                               true,
+                               'comma',
+                               false
                        ),
                        array( '#REDIRECT [[bar]]',
                        ),
                        array( '#REDIRECT [[bar]]',
-                              true,
-                              'link',
-                              false
+                               true,
+                               'link',
+                               false
                        ),
                );
        }
                        ),
                );
        }
@@ -219,28 +219,28 @@ class JavaScriptContentTest extends TextContentTest {
        public static function dataGetTextForSummary() {
                return array(
                        array( "hello\nworld.",
        public static function dataGetTextForSummary() {
                return array(
                        array( "hello\nworld.",
-                              16,
-                              'hello world.',
+                               16,
+                               'hello world.',
                        ),
                        array( 'hello world.',
                        ),
                        array( 'hello world.',
-                              8,
-                              'hello...',
+                               8,
+                               'hello...',
                        ),
                        array( '[[hello world]].',
                        ),
                        array( '[[hello world]].',
-                              8,
-                              '[[hel...',
+                               8,
+                               '[[hel...',
                        ),
                );
        }
 
                        ),
                );
        }
 
-       public function testMatchMagicWord( ) {
+       public function testMatchMagicWord() {
                $mw = MagicWord::get( "staticredirect" );
 
                $content = $this->newContent( "#REDIRECT [[FOO]]\n__STATICREDIRECT__" );
                $this->assertFalse( $content->matchMagicWord( $mw ), "should not have matched magic word, since it's not wikitext" );
        }
 
                $mw = MagicWord::get( "staticredirect" );
 
                $content = $this->newContent( "#REDIRECT [[FOO]]\n__STATICREDIRECT__" );
                $this->assertFalse( $content->matchMagicWord( $mw ), "should not have matched magic word, since it's not wikitext" );
        }
 
-       public function testUpdateRedirect( ) {
+       public function testUpdateRedirect() {
                $target = Title::newFromText( "testUpdateRedirect_target" );
 
                $content = $this->newContent( "#REDIRECT [[Someplace]]" );
                $target = Title::newFromText( "testUpdateRedirect_target" );
 
                $content = $this->newContent( "#REDIRECT [[Someplace]]" );
@@ -261,7 +261,7 @@ class JavaScriptContentTest extends TextContentTest {
                $this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $content->getContentHandler()->getModelID() );
        }
 
                $this->assertEquals( CONTENT_MODEL_JAVASCRIPT, $content->getContentHandler()->getModelID() );
        }
 
-       public static function dataEquals( ) {
+       public static function dataEquals() {
                return array(
                        array( new JavaScriptContent( "hallo" ), null, false ),
                        array( new JavaScriptContent( "hallo" ), new JavaScriptContent( "hallo" ), true ),
                return array(
                        array( new JavaScriptContent( "hallo" ), null, false ),
                        array( new JavaScriptContent( "hallo" ), new JavaScriptContent( "hallo" ), true ),
index 57b7c10..382f71a 100644 (file)
@@ -143,7 +143,7 @@ class TextContentTest extends MediaWikiLangTestCase {
         */
        public function testGetRedirectTarget( $text, $expected ) {
                $content = $this->newContent( $text );
         */
        public function testGetRedirectTarget( $text, $expected ) {
                $content = $this->newContent( $text );
-               $t = $content->getRedirectTarget( );
+               $t = $content->getRedirectTarget();
 
                if ( is_null( $expected ) ) {
                        $this->assertNull( $t, "text should not have generated a redirect target: $text" );
 
                if ( is_null( $expected ) ) {
                        $this->assertNull( $t, "text should not have generated a redirect target: $text" );
@@ -158,7 +158,7 @@ class TextContentTest extends MediaWikiLangTestCase {
        public function testIsRedirect( $text, $expected ) {
                $content = $this->newContent( $text );
 
        public function testIsRedirect( $text, $expected ) {
                $content = $this->newContent( $text );
 
-               $this->assertEquals( !is_null($expected), $content->isRedirect() );
+               $this->assertEquals( !is_null( $expected ), $content->isRedirect() );
        }
 
        /**
        }
 
        /**
@@ -184,29 +184,28 @@ class TextContentTest extends MediaWikiLangTestCase {
        public static function dataIsCountable() {
                return array(
                        array( '',
        public static function dataIsCountable() {
                return array(
                        array( '',
-                              null,
-                              'any',
-                              true
+                               null,
+                               'any',
+                               true
                        ),
                        array( 'Foo',
                        ),
                        array( 'Foo',
-                              null,
-                              'any',
-                              true
+                               null,
+                               'any',
+                               true
                        ),
                        array( 'Foo',
                        ),
                        array( 'Foo',
-                              null,
-                              'comma',
-                              false
+                               null,
+                               'comma',
+                               false
                        ),
                        array( 'Foo, bar',
                        ),
                        array( 'Foo, bar',
-                              null,
-                              'comma',
-                              false
+                               null,
+                               'comma',
+                               false
                        ),
                );
        }
 
                        ),
                );
        }
 
-
        /**
         * @dataProvider dataIsCountable
         * @group Database
        /**
         * @dataProvider dataIsCountable
         * @group Database
@@ -223,22 +222,22 @@ class TextContentTest extends MediaWikiLangTestCase {
                $wgArticleCountMethod = $old;
 
                $this->assertEquals( $expected, $v, 'isCountable() returned unexpected value ' . var_export( $v, true )
                $wgArticleCountMethod = $old;
 
                $this->assertEquals( $expected, $v, 'isCountable() returned unexpected value ' . var_export( $v, true )
-                                                   . ' instead of ' . var_export( $expected, true ) . " in mode `$mode` for text \"$text\"" );
+                       . ' instead of ' . var_export( $expected, true ) . " in mode `$mode` for text \"$text\"" );
        }
 
        public static function dataGetTextForSummary() {
                return array(
                        array( "hello\nworld.",
        }
 
        public static function dataGetTextForSummary() {
                return array(
                        array( "hello\nworld.",
-                              16,
-                              'hello world.',
+                               16,
+                               'hello world.',
                        ),
                        array( 'hello world.',
                        ),
                        array( 'hello world.',
-                              8,
-                              'hello...',
+                               8,
+                               'hello...',
                        ),
                        array( '[[hello world]].',
                        ),
                        array( '[[hello world]].',
-                              8,
-                              '[[hel...',
+                               8,
+                               '[[hel...',
                        ),
                );
        }
                        ),
                );
        }
@@ -252,8 +251,7 @@ class TextContentTest extends MediaWikiLangTestCase {
                $this->assertEquals( $expected, $content->getTextForSummary( $maxlength ) );
        }
 
                $this->assertEquals( $expected, $content->getTextForSummary( $maxlength ) );
        }
 
-
-       public function testGetTextForSearchIndex( ) {
+       public function testGetTextForSearchIndex() {
                $content = $this->newContent( 'hello world.' );
 
                $this->assertEquals( 'hello world.', $content->getTextForSearchIndex() );
                $content = $this->newContent( 'hello world.' );
 
                $this->assertEquals( 'hello world.', $content->getTextForSearchIndex() );
@@ -267,19 +265,19 @@ class TextContentTest extends MediaWikiLangTestCase {
                $this->assertEquals( 'hello world.', $copy->getNativeData() );
        }
 
                $this->assertEquals( 'hello world.', $copy->getNativeData() );
        }
 
-       public function testGetSize( ) {
+       public function testGetSize() {
                $content = $this->newContent( 'hello world.' );
 
                $this->assertEquals( 12, $content->getSize() );
        }
 
                $content = $this->newContent( 'hello world.' );
 
                $this->assertEquals( 12, $content->getSize() );
        }
 
-       public function testGetNativeData( ) {
+       public function testGetNativeData() {
                $content = $this->newContent( 'hello world.' );
 
                $this->assertEquals( 'hello world.', $content->getNativeData() );
        }
 
                $content = $this->newContent( 'hello world.' );
 
                $this->assertEquals( 'hello world.', $content->getNativeData() );
        }
 
-       public function testGetWikitextForTransclusion( ) {
+       public function testGetWikitextForTransclusion() {
                $content = $this->newContent( 'hello world.' );
 
                $this->assertEquals( 'hello world.', $content->getWikitextForTransclusion() );
                $content = $this->newContent( 'hello world.' );
 
                $this->assertEquals( 'hello world.', $content->getWikitextForTransclusion() );
@@ -297,7 +295,7 @@ class TextContentTest extends MediaWikiLangTestCase {
                $this->assertEquals( CONTENT_MODEL_TEXT, $content->getContentHandler()->getModelID() );
        }
 
                $this->assertEquals( CONTENT_MODEL_TEXT, $content->getContentHandler()->getModelID() );
        }
 
-       public static function dataIsEmpty( ) {
+       public static function dataIsEmpty() {
                return array(
                        array( '', true ),
                        array( '  ', false ),
                return array(
                        array( '', true ),
                        array( '  ', false ),
@@ -315,7 +313,7 @@ class TextContentTest extends MediaWikiLangTestCase {
                $this->assertEquals( $empty, $content->isEmpty() );
        }
 
                $this->assertEquals( $empty, $content->isEmpty() );
        }
 
-       public static function dataEquals( ) {
+       public static function dataEquals() {
                return array(
                        array( new TextContent( "hallo" ), null, false ),
                        array( new TextContent( "hallo" ), new TextContent( "hallo" ), true ),
                return array(
                        array( new TextContent( "hallo" ), null, false ),
                        array( new TextContent( "hallo" ), new TextContent( "hallo" ), true ),
@@ -334,13 +332,13 @@ class TextContentTest extends MediaWikiLangTestCase {
 
        public static function dataGetDeletionUpdates() {
                return array(
 
        public static function dataGetDeletionUpdates() {
                return array(
-                       array("TextContentTest_testGetSecondaryDataUpdates_1",
+                       array( "TextContentTest_testGetSecondaryDataUpdates_1",
                                CONTENT_MODEL_TEXT, "hello ''world''\n",
                                CONTENT_MODEL_TEXT, "hello ''world''\n",
-                               array( )
+                               array()
                        ),
                        ),
-                       array("TextContentTest_testGetSecondaryDataUpdates_2",
+                       array( "TextContentTest_testGetSecondaryDataUpdates_2",
                                CONTENT_MODEL_TEXT, "hello [[world test 21344]]\n",
                                CONTENT_MODEL_TEXT, "hello [[world test 21344]]\n",
-                               array( )
+                               array()
                        ),
                        // TODO: more...?
                );
                        ),
                        // TODO: more...?
                );
@@ -363,7 +361,7 @@ class TextContentTest extends MediaWikiLangTestCase {
                // make updates accessible by class name
                foreach ( $updates as $update ) {
                        $class = get_class( $update );
                // make updates accessible by class name
                foreach ( $updates as $update ) {
                        $class = get_class( $update );
-                       $updates[ $class ] = $update;
+                       $updates[$class] = $update;
                }
 
                if ( !$expectedStuff ) {
                }
 
                if ( !$expectedStuff ) {
@@ -374,7 +372,7 @@ class TextContentTest extends MediaWikiLangTestCase {
                foreach ( $expectedStuff as $class => $fieldValues ) {
                        $this->assertArrayHasKey( $class, $updates, "missing an update of type $class" );
 
                foreach ( $expectedStuff as $class => $fieldValues ) {
                        $this->assertArrayHasKey( $class, $updates, "missing an update of type $class" );
 
-                       $update = $updates[ $class ];
+                       $update = $updates[$class];
 
                        foreach ( $fieldValues as $field => $value ) {
                                $v = $update->$field; #if the field doesn't exist, just crash and burn
 
                        foreach ( $fieldValues as $field => $value ) {
                                $v = $update->$field; #if the field doesn't exist, just crash and burn
index 8121099..0f6a968 100644 (file)
@@ -16,7 +16,7 @@ class WikitextContentHandlerTest extends MediaWikiLangTestCase {
                $this->handler = ContentHandler::getForModelID( CONTENT_MODEL_WIKITEXT );
        }
 
                $this->handler = ContentHandler::getForModelID( CONTENT_MODEL_WIKITEXT );
        }
 
-       public function testSerializeContent( ) {
+       public function testSerializeContent() {
                $content = new WikitextContent( 'hello world' );
 
                $this->assertEquals( 'hello world', $this->handler->serializeContent( $content ) );
                $content = new WikitextContent( 'hello world' );
 
                $this->assertEquals( 'hello world', $this->handler->serializeContent( $content ) );
@@ -30,7 +30,7 @@ class WikitextContentHandlerTest extends MediaWikiLangTestCase {
                }
        }
 
                }
        }
 
-       public function testUnserializeContent( ) {
+       public function testUnserializeContent() {
                $content = $this->handler->unserializeContent( 'hello world' );
                $this->assertEquals( 'hello world', $content->getNativeData() );
 
                $content = $this->handler->unserializeContent( 'hello world' );
                $this->assertEquals( 'hello world', $content->getNativeData() );
 
@@ -52,7 +52,7 @@ class WikitextContentHandlerTest extends MediaWikiLangTestCase {
                $this->assertEquals( '', $content->getNativeData() );
        }
 
                $this->assertEquals( '', $content->getNativeData() );
        }
 
-       public static function dataIsSupportedFormat( ) {
+       public static function dataIsSupportedFormat() {
                return array(
                        array( null, true ),
                        array( CONTENT_FORMAT_WIKITEXT, true ),
                return array(
                        array( null, true ),
                        array( CONTENT_FORMAT_WIKITEXT, true ),
@@ -67,21 +67,22 @@ class WikitextContentHandlerTest extends MediaWikiLangTestCase {
                $this->assertEquals( $supported, $this->handler->isSupportedFormat( $format ) );
        }
 
                $this->assertEquals( $supported, $this->handler->isSupportedFormat( $format ) );
        }
 
-       public static function dataMerge3( ) {
+       public static function dataMerge3() {
                return array(
                return array(
-                       array( "first paragraph
+                       array(
+                               "first paragraph
 
                                        second paragraph\n",
 
 
                                        second paragraph\n",
 
-                                       "FIRST paragraph
+                               "FIRST paragraph
 
                                        second paragraph\n",
 
 
                                        second paragraph\n",
 
-                                       "first paragraph
+                               "first paragraph
 
                                        SECOND paragraph\n",
 
 
                                        SECOND paragraph\n",
 
-                                       "FIRST paragraph
+                               "FIRST paragraph
 
                                        SECOND paragraph\n",
                        ),
 
                                        SECOND paragraph\n",
                        ),
@@ -89,13 +90,12 @@ class WikitextContentHandlerTest extends MediaWikiLangTestCase {
                        array( "first paragraph
                                        second paragraph\n",
 
                        array( "first paragraph
                                        second paragraph\n",
 
-                                  "Bla bla\n",
+                               "Bla bla\n",
 
 
-                                  "Blubberdibla\n",
+                               "Blubberdibla\n",
 
 
-                                  false,
+                               false,
                        ),
                        ),
-
                );
        }
 
                );
        }
 
@@ -115,7 +115,7 @@ class WikitextContentHandlerTest extends MediaWikiLangTestCase {
                $this->assertEquals( $expected, $merged ? $merged->getNativeData() : $merged );
        }
 
                $this->assertEquals( $expected, $merged ? $merged->getNativeData() : $merged );
        }
 
-       public static function dataGetAutosummary( ) {
+       public static function dataGetAutosummary() {
                return array(
                        array(
                                'Hello there, world!',
                return array(
                        array(
                                'Hello there, world!',
index 7cf473e..c9eecf7 100644 (file)
@@ -7,10 +7,7 @@
  *        ^--- needed, because we do need the database to test link updates
  */
 class WikitextContentTest extends TextContentTest {
  *        ^--- needed, because we do need the database to test link updates
  */
 class WikitextContentTest extends TextContentTest {
-
-       static $sections =
-
-"Intro
+       static $sections = "Intro
 
 == stuff ==
 hello world
 
 == stuff ==
 hello world
@@ -102,17 +99,17 @@ more stuff
        public static function dataGetSection() {
                return array(
                        array( WikitextContentTest::$sections,
        public static function dataGetSection() {
                return array(
                        array( WikitextContentTest::$sections,
-                                       "0",
-                                       "Intro"
+                               "0",
+                               "Intro"
                        ),
                        array( WikitextContentTest::$sections,
                        ),
                        array( WikitextContentTest::$sections,
-                                       "2",
-"== test ==
+                               "2",
+                               "== test ==
 just a test"
                        ),
                        array( WikitextContentTest::$sections,
 just a test"
                        ),
                        array( WikitextContentTest::$sections,
-                                       "8",
-                                       false
+                               "8",
+                               false
                        ),
                );
        }
                        ),
                );
        }
@@ -136,34 +133,34 @@ just a test"
        public static function dataReplaceSection() {
                return array(
                        array( WikitextContentTest::$sections,
        public static function dataReplaceSection() {
                return array(
                        array( WikitextContentTest::$sections,
-                              "0",
-                              "No more",
-                              null,
-                              trim( preg_replace( '/^Intro/sm', 'No more', WikitextContentTest::$sections ) )
+                               "0",
+                               "No more",
+                               null,
+                               trim( preg_replace( '/^Intro/sm', 'No more', WikitextContentTest::$sections ) )
                        ),
                        array( WikitextContentTest::$sections,
                        ),
                        array( WikitextContentTest::$sections,
-                              "",
-                              "No more",
-                              null,
-                              "No more"
+                               "",
+                               "No more",
+                               null,
+                               "No more"
                        ),
                        array( WikitextContentTest::$sections,
                        ),
                        array( WikitextContentTest::$sections,
-                              "2",
-                              "== TEST ==\nmore fun",
-                              null,
-                              trim( preg_replace( '/^== test ==.*== foo ==/sm', "== TEST ==\nmore fun\n\n== foo ==", WikitextContentTest::$sections ) )
+                               "2",
+                               "== TEST ==\nmore fun",
+                               null,
+                               trim( preg_replace( '/^== test ==.*== foo ==/sm', "== TEST ==\nmore fun\n\n== foo ==", WikitextContentTest::$sections ) )
                        ),
                        array( WikitextContentTest::$sections,
                        ),
                        array( WikitextContentTest::$sections,
-                              "8",
-                              "No more",
-                              null,
-                              WikitextContentTest::$sections
+                               "8",
+                               "No more",
+                               null,
+                               WikitextContentTest::$sections
                        ),
                        array( WikitextContentTest::$sections,
                        ),
                        array( WikitextContentTest::$sections,
-                              "new",
-                              "No more",
-                              "New",
-                              trim( WikitextContentTest::$sections ) . "\n\n\n== New ==\n\nNo more"
+                               "new",
+                               "No more",
+                               "New",
+                               trim( WikitextContentTest::$sections ) . "\n\n\n== New ==\n\nNo more"
                        ),
                );
        }
                        ),
                );
        }
@@ -178,7 +175,7 @@ just a test"
                $this->assertEquals( $expected, is_null( $c ) ? null : $c->getNativeData() );
        }
 
                $this->assertEquals( $expected, is_null( $c ) ? null : $c->getNativeData() );
        }
 
-       public function testAddSectionHeader( ) {
+       public function testAddSectionHeader() {
                $content = $this->newContent( 'hello world' );
                $content = $content->addSectionHeader( 'test' );
 
                $content = $this->newContent( 'hello world' );
                $content = $content->addSectionHeader( 'test' );
 
@@ -188,10 +185,10 @@ just a test"
        public static function dataPreSaveTransform() {
                return array(
                        array( 'hello this is ~~~',
        public static function dataPreSaveTransform() {
                return array(
                        array( 'hello this is ~~~',
-                              "hello this is [[Special:Contributions/127.0.0.1|127.0.0.1]]",
+                               "hello this is [[Special:Contributions/127.0.0.1|127.0.0.1]]",
                        ),
                        array( 'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
                        ),
                        array( 'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
-                              'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
+                               'hello \'\'this\'\' is <nowiki>~~~</nowiki>',
                        ),
                        array( // rtrim
                                " Foo \n ",
                        ),
                        array( // rtrim
                                " Foo \n ",
@@ -203,10 +200,10 @@ just a test"
        public static function dataPreloadTransform() {
                return array(
                        array( 'hello this is ~~~',
        public static function dataPreloadTransform() {
                return array(
                        array( 'hello this is ~~~',
-                              "hello this is ~~~",
+                               "hello this is ~~~",
                        ),
                        array( 'hello \'\'this\'\' is <noinclude>foo</noinclude><includeonly>bar</includeonly>',
                        ),
                        array( 'hello \'\'this\'\' is <noinclude>foo</noinclude><includeonly>bar</includeonly>',
-                              'hello \'\'this\'\' is bar',
+                               'hello \'\'this\'\' is bar',
                        ),
                );
        }
                        ),
                );
        }
@@ -214,13 +211,13 @@ just a test"
        public static function dataGetRedirectTarget() {
                return array(
                        array( '#REDIRECT [[Test]]',
        public static function dataGetRedirectTarget() {
                return array(
                        array( '#REDIRECT [[Test]]',
-                              'Test',
+                               'Test',
                        ),
                        array( '#REDIRECT Test',
                        ),
                        array( '#REDIRECT Test',
-                              null,
+                               null,
                        ),
                        array( '* #REDIRECT [[Test]]',
                        ),
                        array( '* #REDIRECT [[Test]]',
-                              null,
+                               null,
                        ),
                );
        }
                        ),
                );
        }
@@ -265,64 +262,64 @@ just a test"
        public static function dataIsCountable() {
                return array(
                        array( '',
        public static function dataIsCountable() {
                return array(
                        array( '',
-                              null,
-                              'any',
-                              true
+                               null,
+                               'any',
+                               true
                        ),
                        array( 'Foo',
                        ),
                        array( 'Foo',
-                              null,
-                              'any',
-                              true
+                               null,
+                               'any',
+                               true
                        ),
                        array( 'Foo',
                        ),
                        array( 'Foo',
-                              null,
-                              'comma',
-                              false
+                               null,
+                               'comma',
+                               false
                        ),
                        array( 'Foo, bar',
                        ),
                        array( 'Foo, bar',
-                              null,
-                              'comma',
-                              true
+                               null,
+                               'comma',
+                               true
                        ),
                        array( 'Foo',
                        ),
                        array( 'Foo',
-                              null,
-                              'link',
-                              false
+                               null,
+                               'link',
+                               false
                        ),
                        array( 'Foo [[bar]]',
                        ),
                        array( 'Foo [[bar]]',
-                              null,
-                              'link',
-                              true
+                               null,
+                               'link',
+                               true
                        ),
                        array( 'Foo',
                        ),
                        array( 'Foo',
-                              true,
-                              'link',
-                              true
+                               true,
+                               'link',
+                               true
                        ),
                        array( 'Foo [[bar]]',
                        ),
                        array( 'Foo [[bar]]',
-                              false,
-                              'link',
-                              false
+                               false,
+                               'link',
+                               false
                        ),
                        array( '#REDIRECT [[bar]]',
                        ),
                        array( '#REDIRECT [[bar]]',
-                              true,
-                              'any',
-                              false
+                               true,
+                               'any',
+                               false
                        ),
                        array( '#REDIRECT [[bar]]',
                        ),
                        array( '#REDIRECT [[bar]]',
-                              true,
-                              'comma',
-                              false
+                               true,
+                               'comma',
+                               false
                        ),
                        array( '#REDIRECT [[bar]]',
                        ),
                        array( '#REDIRECT [[bar]]',
-                              true,
-                              'link',
-                              false
+                               true,
+                               'link',
+                               false
                        ),
                );
        }
 
                        ),
                );
        }
 
-       public function testMatchMagicWord( ) {
+       public function testMatchMagicWord() {
                $mw = MagicWord::get( "staticredirect" );
 
                $content = $this->newContent( "#REDIRECT [[FOO]]\n__STATICREDIRECT__" );
                $mw = MagicWord::get( "staticredirect" );
 
                $content = $this->newContent( "#REDIRECT [[FOO]]\n__STATICREDIRECT__" );
@@ -332,7 +329,7 @@ just a test"
                $this->assertFalse( $content->matchMagicWord( $mw ), "should not have matched magic word" );
        }
 
                $this->assertFalse( $content->matchMagicWord( $mw ), "should not have matched magic word" );
        }
 
-       public function testUpdateRedirect( ) {
+       public function testUpdateRedirect() {
                $target = Title::newFromText( "testUpdateRedirect_target" );
 
                // test with non-redirect page
                $target = Title::newFromText( "testUpdateRedirect_target" );
 
                // test with non-redirect page
@@ -363,7 +360,7 @@ just a test"
                $this->assertEquals( CONTENT_MODEL_WIKITEXT, $content->getContentHandler()->getModelID() );
        }
 
                $this->assertEquals( CONTENT_MODEL_WIKITEXT, $content->getContentHandler()->getModelID() );
        }
 
-       public static function dataEquals( ) {
+       public static function dataEquals() {
                return array(
                        array( new WikitextContent( "hallo" ), null, false ),
                        array( new WikitextContent( "hallo" ), new WikitextContent( "hallo" ), true ),
                return array(
                        array( new WikitextContent( "hallo" ), null, false ),
                        array( new WikitextContent( "hallo" ), new WikitextContent( "hallo" ), true ),
@@ -375,16 +372,15 @@ just a test"
 
        public static function dataGetDeletionUpdates() {
                return array(
 
        public static function dataGetDeletionUpdates() {
                return array(
-                       array("WikitextContentTest_testGetSecondaryDataUpdates_1",
+                       array( "WikitextContentTest_testGetSecondaryDataUpdates_1",
                                CONTENT_MODEL_WIKITEXT, "hello ''world''\n",
                                CONTENT_MODEL_WIKITEXT, "hello ''world''\n",
-                               array( 'LinksDeletionUpdate' => array( ) )
+                               array( 'LinksDeletionUpdate' => array() )
                        ),
                        ),
-                       array("WikitextContentTest_testGetSecondaryDataUpdates_2",
+                       array( "WikitextContentTest_testGetSecondaryDataUpdates_2",
                                CONTENT_MODEL_WIKITEXT, "hello [[world test 21344]]\n",
                                CONTENT_MODEL_WIKITEXT, "hello [[world test 21344]]\n",
-                               array( 'LinksDeletionUpdate' => array( ) )
+                               array( 'LinksDeletionUpdate' => array() )
                        ),
                        // @todo: more...?
                );
        }
                        ),
                        // @todo: more...?
                );
        }
-
 }
 }
index 9a62abc..0979243 100644 (file)
@@ -39,8 +39,8 @@ class DatabaseSQLTest extends MediaWikiTestCase {
                                        'conds' => array( 'alias' => 'text' ),
                                ),
                                "SELECT  field,field2 AS alias  " .
                                        'conds' => array( 'alias' => 'text' ),
                                ),
                                "SELECT  field,field2 AS alias  " .
-                               "FROM `unittest_table`  " .
-                               "WHERE alias = 'text'"
+                                       "FROM `unittest_table`  " .
+                                       "WHERE alias = 'text'"
                        ),
                        array(
                                array(
                        ),
                        array(
                                array(
@@ -50,10 +50,10 @@ class DatabaseSQLTest extends MediaWikiTestCase {
                                        'options' => array( 'LIMIT' => 1, 'ORDER BY' => 'field' ),
                                ),
                                "SELECT  field,field2 AS alias  " .
                                        'options' => array( 'LIMIT' => 1, 'ORDER BY' => 'field' ),
                                ),
                                "SELECT  field,field2 AS alias  " .
-                               "FROM `unittest_table`  " .
-                               "WHERE alias = 'text'  " .
-                               "ORDER BY field " .
-                               "LIMIT 1"
+                                       "FROM `unittest_table`  " .
+                                       "WHERE alias = 'text'  " .
+                                       "ORDER BY field " .
+                                       "LIMIT 1"
                        ),
                        array(
                                array(
                        ),
                        array(
                                array(
@@ -63,13 +63,13 @@ class DatabaseSQLTest extends MediaWikiTestCase {
                                        'options' => array( 'LIMIT' => 1, 'ORDER BY' => 'field' ),
                                        'join_conds' => array( 't2' => array(
                                                'LEFT JOIN', 'tid = t2.id'
                                        'options' => array( 'LIMIT' => 1, 'ORDER BY' => 'field' ),
                                        'join_conds' => array( 't2' => array(
                                                'LEFT JOIN', 'tid = t2.id'
-                                       )),
+                                       ) ),
                                ),
                                "SELECT  tid,field,field2 AS alias,t2.id  " .
                                ),
                                "SELECT  tid,field,field2 AS alias,t2.id  " .
-                               "FROM `unittest_table` LEFT JOIN `unittest_table2` `t2` ON ((tid = t2.id))  " .
-                               "WHERE alias = 'text'  " .
-                               "ORDER BY field " .
-                               "LIMIT 1"
+                                       "FROM `unittest_table` LEFT JOIN `unittest_table2` `t2` ON ((tid = t2.id))  " .
+                                       "WHERE alias = 'text'  " .
+                                       "ORDER BY field " .
+                                       "LIMIT 1"
                        ),
                        array(
                                array(
                        ),
                        array(
                                array(
@@ -79,13 +79,13 @@ class DatabaseSQLTest extends MediaWikiTestCase {
                                        'options' => array( 'LIMIT' => 1, 'GROUP BY' => 'field', 'HAVING' => 'COUNT(*) > 1' ),
                                        'join_conds' => array( 't2' => array(
                                                'LEFT JOIN', 'tid = t2.id'
                                        'options' => array( 'LIMIT' => 1, 'GROUP BY' => 'field', 'HAVING' => 'COUNT(*) > 1' ),
                                        'join_conds' => array( 't2' => array(
                                                'LEFT JOIN', 'tid = t2.id'
-                                       )),
+                                       ) ),
                                ),
                                "SELECT  tid,field,field2 AS alias,t2.id  " .
                                ),
                                "SELECT  tid,field,field2 AS alias,t2.id  " .
-                               "FROM `unittest_table` LEFT JOIN `unittest_table2` `t2` ON ((tid = t2.id))  " .
-                               "WHERE alias = 'text'  " .
-                               "GROUP BY field HAVING COUNT(*) > 1 " .
-                               "LIMIT 1"
+                                       "FROM `unittest_table` LEFT JOIN `unittest_table2` `t2` ON ((tid = t2.id))  " .
+                                       "WHERE alias = 'text'  " .
+                                       "GROUP BY field HAVING COUNT(*) > 1 " .
+                                       "LIMIT 1"
                        ),
                        array(
                                array(
                        ),
                        array(
                                array(
@@ -95,13 +95,13 @@ class DatabaseSQLTest extends MediaWikiTestCase {
                                        'options' => array( 'LIMIT' => 1, 'GROUP BY' => array( 'field', 'field2' ), 'HAVING' => array( 'COUNT(*) > 1', 'field' => 1 ) ),
                                        'join_conds' => array( 't2' => array(
                                                'LEFT JOIN', 'tid = t2.id'
                                        'options' => array( 'LIMIT' => 1, 'GROUP BY' => array( 'field', 'field2' ), 'HAVING' => array( 'COUNT(*) > 1', 'field' => 1 ) ),
                                        'join_conds' => array( 't2' => array(
                                                'LEFT JOIN', 'tid = t2.id'
-                                       )),
+                                       ) ),
                                ),
                                "SELECT  tid,field,field2 AS alias,t2.id  " .
                                ),
                                "SELECT  tid,field,field2 AS alias,t2.id  " .
-                               "FROM `unittest_table` LEFT JOIN `unittest_table2` `t2` ON ((tid = t2.id))  " .
-                               "WHERE alias = 'text'  " .
-                               "GROUP BY field,field2 HAVING (COUNT(*) > 1) AND field = '1' " .
-                               "LIMIT 1"
+                                       "FROM `unittest_table` LEFT JOIN `unittest_table2` `t2` ON ((tid = t2.id))  " .
+                                       "WHERE alias = 'text'  " .
+                                       "GROUP BY field,field2 HAVING (COUNT(*) > 1) AND field = '1' " .
+                                       "LIMIT 1"
                        ),
                );
        }
                        ),
                );
        }
index 3e71603..7b84d47 100644 (file)
@@ -3,7 +3,7 @@
 class MockDatabaseSqlite extends DatabaseSqliteStandalone {
        var $lastQuery;
 
 class MockDatabaseSqlite extends DatabaseSqliteStandalone {
        var $lastQuery;
 
-       function __construct( ) {
+       function __construct() {
                parent::__construct( ':memory:' );
        }
 
                parent::__construct( ':memory:' );
        }
 
@@ -48,8 +48,8 @@ class DatabaseSqliteTest extends MediaWikiTestCase {
        private function assertResultIs( $expected, $res ) {
                $this->assertNotNull( $res );
                $i = 0;
        private function assertResultIs( $expected, $res ) {
                $this->assertNotNull( $res );
                $i = 0;
-               foreach( $res as $row ) {
-                       foreach( $expected[$i] as $key => $value ) {
+               foreach ( $res as $row ) {
+                       foreach ( $expected[$i] as $key => $value ) {
                                $this->assertTrue( isset( $row->$key ) );
                                $this->assertEquals( $value, $row->$key );
                        }
                                $this->assertTrue( isset( $row->$key ) );
                                $this->assertEquals( $value, $row->$key );
                        }
@@ -108,38 +108,38 @@ class DatabaseSqliteTest extends MediaWikiTestCase {
                $this->assertEquals( 'foo', $this->replaceVars( 'foo' ), "Don't break anything accidentally" );
 
                $this->assertEquals( "CREATE TABLE /**/foo (foo_key INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "
                $this->assertEquals( 'foo', $this->replaceVars( 'foo' ), "Don't break anything accidentally" );
 
                $this->assertEquals( "CREATE TABLE /**/foo (foo_key INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "
-                       . "foo_bar TEXT, foo_name TEXT NOT NULL DEFAULT '', foo_int INTEGER, foo_int2 INTEGER );",
+                               . "foo_bar TEXT, foo_name TEXT NOT NULL DEFAULT '', foo_int INTEGER, foo_int2 INTEGER );",
                        $this->replaceVars( "CREATE TABLE /**/foo (foo_key int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
                        foo_bar char(13), foo_name varchar(255) binary NOT NULL DEFAULT '', foo_int tinyint ( 8 ), foo_int2 int(16) ) ENGINE=MyISAM;" )
                        $this->replaceVars( "CREATE TABLE /**/foo (foo_key int unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
                        foo_bar char(13), foo_name varchar(255) binary NOT NULL DEFAULT '', foo_int tinyint ( 8 ), foo_int2 int(16) ) ENGINE=MyISAM;" )
-                       );
+               );
 
                $this->assertEquals( "CREATE TABLE foo ( foo1 REAL, foo2 REAL, foo3 REAL );",
                        $this->replaceVars( "CREATE TABLE foo ( foo1 FLOAT, foo2 DOUBLE( 1,10), foo3 DOUBLE PRECISION );" )
 
                $this->assertEquals( "CREATE TABLE foo ( foo1 REAL, foo2 REAL, foo3 REAL );",
                        $this->replaceVars( "CREATE TABLE foo ( foo1 FLOAT, foo2 DOUBLE( 1,10), foo3 DOUBLE PRECISION );" )
-                       );
+               );
 
                $this->assertEquals( "CREATE TABLE foo ( foo_binary1 BLOB, foo_binary2 BLOB );",
                        $this->replaceVars( "CREATE TABLE foo ( foo_binary1 binary(16), foo_binary2 varbinary(32) );" )
 
                $this->assertEquals( "CREATE TABLE foo ( foo_binary1 BLOB, foo_binary2 BLOB );",
                        $this->replaceVars( "CREATE TABLE foo ( foo_binary1 binary(16), foo_binary2 varbinary(32) );" )
-                       );
+               );
 
                $this->assertEquals( "CREATE TABLE text ( text_foo TEXT );",
                        $this->replaceVars( "CREATE TABLE text ( text_foo tinytext );" ),
                        'Table name changed'
 
                $this->assertEquals( "CREATE TABLE text ( text_foo TEXT );",
                        $this->replaceVars( "CREATE TABLE text ( text_foo tinytext );" ),
                        'Table name changed'
-                       );
+               );
 
                $this->assertEquals( "CREATE TABLE foo ( foobar INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL );",
 
                $this->assertEquals( "CREATE TABLE foo ( foobar INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL );",
-                       $this->replaceVars("CREATE TABLE foo ( foobar INT PRIMARY KEY NOT NULL AUTO_INCREMENT );" )
-                       );
+                       $this->replaceVars( "CREATE TABLE foo ( foobar INT PRIMARY KEY NOT NULL AUTO_INCREMENT );" )
+               );
                $this->assertEquals( "CREATE TABLE foo ( foobar INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL );",
                $this->assertEquals( "CREATE TABLE foo ( foobar INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL );",
-                       $this->replaceVars("CREATE TABLE foo ( foobar INT PRIMARY KEY AUTO_INCREMENT NOT NULL );" )
-                       );
+                       $this->replaceVars( "CREATE TABLE foo ( foobar INT PRIMARY KEY AUTO_INCREMENT NOT NULL );" )
+               );
 
                $this->assertEquals( "CREATE TABLE enums( enum1 TEXT, myenum TEXT)",
                        $this->replaceVars( "CREATE TABLE enums( enum1 ENUM('A', 'B'), myenum ENUM ('X', 'Y'))" )
 
                $this->assertEquals( "CREATE TABLE enums( enum1 TEXT, myenum TEXT)",
                        $this->replaceVars( "CREATE TABLE enums( enum1 ENUM('A', 'B'), myenum ENUM ('X', 'Y'))" )
-                       );
+               );
 
                $this->assertEquals( "ALTER TABLE foo ADD COLUMN foo_bar INTEGER DEFAULT 42",
                        $this->replaceVars( "ALTER TABLE foo\nADD COLUMN foo_bar int(10) unsigned DEFAULT 42" )
 
                $this->assertEquals( "ALTER TABLE foo ADD COLUMN foo_bar INTEGER DEFAULT 42",
                        $this->replaceVars( "ALTER TABLE foo\nADD COLUMN foo_bar int(10) unsigned DEFAULT 42" )
-                       );
+               );
        }
 
        public function testTableName() {
        }
 
        public function testTableName() {
@@ -381,9 +381,9 @@ class DatabaseSqliteTest extends MediaWikiTestCase {
 
        function testCaseInsensitiveLike() {
                // TODO: Test this for all databases
 
        function testCaseInsensitiveLike() {
                // TODO: Test this for all databases
-               $db = new DatabaseSqliteStandalone( ':memory:' );\r
-               $res = $db->query( 'SELECT "a" LIKE "A" AS a' );\r
-               $row = $res->fetchRow();\r
-               $this->assertFalse( (bool)$row['a'] );\r
+               $db = new DatabaseSqliteStandalone( ':memory:' );
+               $res = $db->query( 'SELECT "a" LIKE "A" AS a' );
+               $row = $res->fetchRow();
+               $this->assertFalse( (bool)$row['a'] );
        }
 }
        }
 }
index 8c992c7..65c80d1 100644 (file)
@@ -206,7 +206,7 @@ class DatabaseTest extends MediaWikiTestCase {
 
        private function dropFunctions() {
                $this->db->query( 'DROP FUNCTION IF EXISTS mw_test_function'
 
        private function dropFunctions() {
                $this->db->query( 'DROP FUNCTION IF EXISTS mw_test_function'
-                       . ( $this->db->getType() == 'postgres'  ? '()' : '' )
+                               . ( $this->db->getType() == 'postgres' ? '()' : '' )
                );
        }
 }
                );
        }
 }
index bd2c388..9026cb9 100644 (file)
@@ -7,7 +7,7 @@ class MWDebugTest extends MediaWikiTestCase {
                parent::setUp();
                // Make sure MWDebug class is enabled
                static $MWDebugEnabled = false;
                parent::setUp();
                // Make sure MWDebug class is enabled
                static $MWDebugEnabled = false;
-               if( !$MWDebugEnabled ) {
+               if ( !$MWDebugEnabled ) {
                        MWDebug::init();
                        $MWDebugEnabled = true;
                }
                        MWDebug::init();
                        $MWDebugEnabled = true;
                }
@@ -23,10 +23,11 @@ class MWDebugTest extends MediaWikiTestCase {
 
        function testAddLog() {
                MWDebug::log( 'logging a string' );
 
        function testAddLog() {
                MWDebug::log( 'logging a string' );
-               $this->assertEquals( array( array(
-                       'msg' => 'logging a string',
-                       'type' => 'log',
-                       'caller' => __METHOD__ ,
+               $this->assertEquals(
+                       array( array(
+                               'msg' => 'logging a string',
+                               'type' => 'log',
+                               'caller' => __METHOD__,
                        ) ),
                        MWDebug::getLog()
                );
                        ) ),
                        MWDebug::getLog()
                );
@@ -34,10 +35,11 @@ class MWDebugTest extends MediaWikiTestCase {
 
        function testAddWarning() {
                MWDebug::warning( 'Warning message' );
 
        function testAddWarning() {
                MWDebug::warning( 'Warning message' );
-               $this->assertEquals( array( array(
-                       'msg' => 'Warning message',
-                       'type' => 'warn',
-                       'caller' => 'MWDebugTest::testAddWarning',
+               $this->assertEquals(
+                       array( array(
+                               'msg' => 'Warning message',
+                               'type' => 'warn',
+                               'caller' => 'MWDebugTest::testAddWarning',
                        ) ),
                        MWDebug::getLog()
                );
                        ) ),
                        MWDebug::getLog()
                );