Pass phpcs-strict on some test files (9/11)
authorSiebrand Mazeland <siebrand@kitano.nl>
Thu, 24 Apr 2014 17:52:09 +0000 (19:52 +0200)
committerChad Horohoe <chadh@wikimedia.org>
Thu, 24 Apr 2014 20:50:47 +0000 (13:50 -0700)
Change-Id: I69f17bf2af45f03274fdb38853184880e46c3514

tests/phpunit/includes/media/JpegTest.php
tests/phpunit/includes/media/PNGTest.php
tests/phpunit/includes/media/SVGMetadataExtractorTest.php
tests/phpunit/includes/media/SVGTest.php
tests/phpunit/includes/media/TiffTest.php
tests/phpunit/includes/normal/CleanUpTest.php
tests/phpunit/includes/objectcache/BagOStuffTest.php
tests/phpunit/includes/parser/MagicVariableTest.php
tests/phpunit/includes/parser/ParserMethodsTest.php
tests/phpunit/includes/parser/PreprocessorTest.php

index 1b28de1..b261137 100644 (file)
@@ -37,7 +37,9 @@ class JpegTest extends MediaWikiTestCase {
        public function testJpegMetadataExtraction() {
                $file = $this->dataFile( 'test.jpg', 'image/jpeg' );
                $res = $this->handler->getMetadata( $file, $this->filePath . 'test.jpg' );
+               // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                $expected = 'a:7:{s:16:"ImageDescription";s:9:"Test file";s:11:"XResolution";s:4:"72/1";s:11:"YResolution";s:4:"72/1";s:14:"ResolutionUnit";i:2;s:16:"YCbCrPositioning";i:1;s:15:"JPEGFileComment";a:1:{i:0;s:17:"Created with GIMP";}s:22:"MEDIAWIKI_EXIF_VERSION";i:2;}';
+               // @codingStandardsIgnoreEnd
 
                // Unserialize in case serialization format ever changes.
                $this->assertEquals( unserialize( $expected ), unserialize( $res ) );
index aa73e2d..59d40de 100644 (file)
@@ -92,7 +92,9 @@ class PNGHandlerTest extends MediaWikiTestCase {
                        array( '', PNGHandler::METADATA_BAD ),
                        array( null, PNGHandler::METADATA_BAD ),
                        array( 'Something invalid!', PNGHandler::METADATA_BAD ),
+                       // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                        array( 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:8;s:9:"colorType";s:10:"truecolour";s:8:"metadata";a:1:{s:15:"_MW_PNG_VERSION";i:1;}}', PNGHandler::METADATA_GOOD ),
+                       // @codingStandardsIgnoreEnd
                );
        }
 
@@ -111,8 +113,10 @@ class PNGHandlerTest extends MediaWikiTestCase {
 
        public static function provideGetMetadata() {
                return array(
+                       // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                        array( 'rgb-na-png.png', 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:8;s:9:"colorType";s:10:"truecolour";s:8:"metadata";a:1:{s:15:"_MW_PNG_VERSION";i:1;}}' ),
                        array( 'xmp.png', 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:1;s:9:"colorType";s:14:"index-coloured";s:8:"metadata";a:2:{s:12:"SerialNumber";s:9:"123456789";s:15:"_MW_PNG_VERSION";i:1;}}' ),
+                       // @codingStandardsIgnoreEnd
                );
        }
 
index ec7b0c9..fa63fa6 100644 (file)
@@ -121,12 +121,15 @@ class SVGMetadataExtractorTest extends MediaWikiTestCase {
 
        public static function provideSvgFilesWithXMLMetadata() {
                $base = __DIR__ . '/../../data/media';
+               // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                $metadata = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
       <ns4:Work xmlns:ns4="http://creativecommons.org/ns#" rdf:about="">
         <ns5:format xmlns:ns5="http://purl.org/dc/elements/1.1/">image/svg+xml</ns5:format>
         <ns5:type xmlns:ns5="http://purl.org/dc/elements/1.1/" rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
       </ns4:Work>
     </rdf:RDF>';
+               // @codingStandardsIgnoreEnd
+
                $metadata = str_replace( "\r", '', $metadata ); // Windows compat
                return array(
                        array(
index 97e6c43..8a3d527 100644 (file)
@@ -40,7 +40,8 @@ class SvgTest extends MediaWikiTestCase {
                return array(
                        array( 'Tux.svg', array(
                                'ObjectName' => 'Tux',
-                               'ImageDescription' => 'For more information see: http://commons.wikimedia.org/wiki/Image:Tux.svg',
+                               'ImageDescription' =>
+                                       'For more information see: http://commons.wikimedia.org/wiki/Image:Tux.svg',
                        ) ),
                        array( 'Wikimedia-logo.svg', array() )
                );
index ca97698..26d7204 100644 (file)
@@ -29,7 +29,11 @@ class TiffTest extends MediaWikiTestCase {
         */
        public function testTiffMetadataExtraction() {
                $res = $this->handler->getMetadata( null, $this->filePath . 'test.tiff' );
+
+               // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                $expected = 'a:16:{s:10:"ImageWidth";i:20;s:11:"ImageLength";i:20;s:13:"BitsPerSample";a:3:{i:0;i:8;i:1;i:8;i:2;i:8;}s:11:"Compression";i:5;s:25:"PhotometricInterpretation";i:2;s:16:"ImageDescription";s:17:"Created with GIMP";s:12:"StripOffsets";i:8;s:11:"Orientation";i:1;s:15:"SamplesPerPixel";i:3;s:12:"RowsPerStrip";i:64;s:15:"StripByteCounts";i:238;s:11:"XResolution";s:19:"1207959552/16777216";s:11:"YResolution";s:19:"1207959552/16777216";s:19:"PlanarConfiguration";i:1;s:14:"ResolutionUnit";i:2;s:22:"MEDIAWIKI_EXIF_VERSION";i:2;}';
+               // @codingStandardsIgnoreEnd
+
                // Re-unserialize in case there are subtle differences between how versions
                // of php serialize stuff.
                $this->assertEquals( unserialize( $expected ), unserialize( $res ) );
index a736234..dff31c1 100644 (file)
@@ -89,7 +89,9 @@ class CleanUpTest extends MediaWikiTestCase {
                                ( $i > UNICODE_SURROGATE_LAST && $i < 0xfffe ) ||
                                ( $i > 0xffff && $i <= UNICODE_MAX )
                        ) {
-                               if ( isset( UtfNormal::$utfCanonicalComp[$char] ) || isset( UtfNormal::$utfCanonicalDecomp[$char] ) ) {
+                               if ( isset( UtfNormal::$utfCanonicalComp[$char] )
+                                       || isset( UtfNormal::$utfCanonicalDecomp[$char] )
+                               ) {
                                        $comp = UtfNormal::NFC( $char );
                                        $this->assertEquals(
                                                bin2hex( $comp ),
@@ -243,12 +245,14 @@ class CleanUpTest extends MediaWikiTestCase {
                                                }
                                        } elseif ( $first > 0xc1 && $first < 0xe0 && $second < 0xc0 ) {
                                                $this->assertEquals(
-                                                       bin2hex( UtfNormal::NFC( $head . chr( $first ) . chr( $second ) ) . UTF8_REPLACEMENT . $tail ),
+                                                       bin2hex( UtfNormal::NFC( $head . chr( $first ) .
+                                                                       chr( $second ) ) . UTF8_REPLACEMENT . $tail ),
                                                        bin2hex( $clean ),
                                                        "Valid 2-byte $x + broken tail" );
                                        } elseif ( $second > 0xc1 && $second < 0xe0 && $third < 0xc0 ) {
                                                $this->assertEquals(
-                                                       bin2hex( $head . UTF8_REPLACEMENT . UtfNormal::NFC( chr( $second ) . chr( $third ) . $tail ) ),
+                                                       bin2hex( $head . UTF8_REPLACEMENT .
+                                                               UtfNormal::NFC( chr( $second ) . chr( $third ) . $tail ) ),
                                                        bin2hex( $clean ),
                                                        "Broken head + valid 2-byte $x" );
                                        } elseif ( ( $first > 0xfd || $second > 0xfd ) &&
index 1670823..1972bb5 100644 (file)
@@ -138,7 +138,10 @@ class BagOStuffTest extends MediaWikiTestCase {
                $this->cache->add( $key1, $value1 );
                $this->cache->add( $key2, $value2 );
 
-               $this->assertEquals( $this->cache->getMulti( array( $key1, $key2 ) ), array( $key1 => $value1, $key2 => $value2 ) );
+               $this->assertEquals(
+                       $this->cache->getMulti( array( $key1, $key2 ) ),
+                       array( $key1 => $value1, $key2 => $value2 )
+               );
 
                // cleanup
                $this->cache->delete( $key1 );
index 2ad2735..b81c973 100644 (file)
@@ -48,7 +48,9 @@ class MagicVariableTest extends MediaWikiTestCase {
 
                # Needs a title to do magic word stuff
                $title = Title::newFromText( 'Tests' );
-               $title->mRedirect = false; # Else it needs a db connection just to check if it's a redirect (when deciding the page language)
+               # Else it needs a db connection just to check if it's a redirect
+               # (when deciding the page language).
+               $title->mRedirect = false;
 
                $this->testParser->setTitle( $title );
        }
index e5c5cb2..229eeb4 100644 (file)
@@ -91,5 +91,6 @@ class ParserMethodsTest extends MediaWikiLangTestCase {
                        ),
                ), $out->getSections(), 'getSections() with proper value when <h2> is used' );
        }
-       //@Todo Add tests for cleanSig() / cleanSigInSig(), getSection(), replaceSection(), getPreloadText()
+       // @todo Add tests for cleanSig() / cleanSigInSig(), getSection(),
+       // replaceSection(), getPreloadText()
 }
index cfb3f72..345fd0a 100644 (file)
@@ -16,7 +16,9 @@ class PreprocessorTest extends MediaWikiTestCase {
                global $wgParserConf, $wgContLang;
                parent::setUp();
                $this->mOptions = ParserOptions::newFromUserAndLang( new User, $wgContLang );
-               $name = isset( $wgParserConf['preprocessorClass'] ) ? $wgParserConf['preprocessorClass'] : 'Preprocessor_DOM';
+               $name = isset( $wgParserConf['preprocessorClass'] )
+                       ? $wgParserConf['preprocessorClass']
+                       : 'Preprocessor_DOM';
 
                $this->mPreprocessor = new $name( $this );
        }
@@ -26,6 +28,7 @@ class PreprocessorTest extends MediaWikiTestCase {
        }
 
        public static function provideCases() {
+               // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                return array(
                        array( "Foo", "<root>Foo</root>" ),
                        array( "<!-- Foo -->", "<root><comment>&lt;!-- Foo --&gt;</comment></root>" ),
@@ -113,6 +116,7 @@ class PreprocessorTest extends MediaWikiTestCase {
                        array( "{{Foo|} Bar=}}", "<root><template><title>Foo</title><part><name>} Bar</name>=<value></value></part></template></root>" ),
                        /* array( file_get_contents( __DIR__ . '/QuoteQuran.txt' ), file_get_contents( __DIR__ . '/QuoteQuranExpanded.txt' ) ), */
                );
+               // @codingStandardsIgnoreEnd
        }
 
        /**
@@ -157,6 +161,7 @@ class PreprocessorTest extends MediaWikiTestCase {
         * These are more complex test cases taken out of wiki articles.
         */
        public static function provideFiles() {
+               // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                return array(
                        array( "QuoteQuran" ), # http://en.wikipedia.org/w/index.php?title=Template:QuoteQuran/sandbox&oldid=237348988 GFDL + CC BY-SA by Striver
                        array( "Factorial" ), # http://en.wikipedia.org/w/index.php?title=Template:Factorial&oldid=98548758 GFDL + CC BY-SA by Polonium
@@ -164,6 +169,7 @@ class PreprocessorTest extends MediaWikiTestCase {
                        array( "Fundraising" ), # http://tl.wiktionary.org/w/index.php?title=MediaWiki:Sitenotice&oldid=5716 GFDL + CC BY-SA, copied there by Sky Harbor.
                        array( "NestedTemplates" ), # bug 27936
                );
+               // @codingStandardsIgnoreEnd
        }
 
        /**
@@ -190,6 +196,7 @@ class PreprocessorTest extends MediaWikiTestCase {
         * Tests from Bug 28642 ยท https://bugzilla.wikimedia.org/28642
         */
        public static function provideHeadings() {
+               // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                return array( /* These should become headings: */
                        array( "== h ==<!--c1-->", "<root><h level=\"2\" i=\"1\">== h ==<comment>&lt;!--c1--&gt;</comment></h></root>" ),
                        array( "== h ==         <!--c1-->", "<root><h level=\"2\" i=\"1\">== h ==       <comment>&lt;!--c1--&gt;</comment></h></root>" ),
@@ -227,6 +234,7 @@ class PreprocessorTest extends MediaWikiTestCase {
                        array( "== h ==<!--c1--> x <!--c2--><!--c3-->  ", "<root>== h ==<comment>&lt;!--c1--&gt;</comment> x <comment>&lt;!--c2--&gt;</comment><comment>&lt;!--c3--&gt;</comment>  </root>" ),
                        array( "== h ==<!--c1--><!--c2--><!--c3--> x ", "<root>== h ==<comment>&lt;!--c1--&gt;</comment><comment>&lt;!--c2--&gt;</comment><comment>&lt;!--c3--&gt;</comment> x </root>" ),
                );
+               // @codingStandardsIgnoreEnd
        }
 
        /**