Pass phpcs-strict on some test files (8/11)
authorSiebrand Mazeland <siebrand@kitano.nl>
Thu, 24 Apr 2014 17:51:33 +0000 (19:51 +0200)
committerChad Horohoe <chadh@wikimedia.org>
Thu, 24 Apr 2014 20:49:48 +0000 (13:49 -0700)
Change-Id: I138c1f9bf2c3c7e9218d5fa29365e78b309fb459

tests/phpunit/includes/HtmlTest.php
tests/phpunit/includes/XmlTest.php
tests/phpunit/includes/api/ApiUploadTest.php
tests/phpunit/includes/htmlform/HTMLCheckMatrixTest.php
tests/phpunit/includes/media/DjVuTest.php
tests/phpunit/includes/media/ExifBitmapTest.php
tests/phpunit/includes/media/ExifRotationTest.php
tests/phpunit/includes/media/GIFTest.php
tests/phpunit/includes/media/IPTCTest.php
tests/phpunit/includes/media/JpegMetadataExtractorTest.php

index f112a00..e934965 100644 (file)
@@ -652,14 +652,16 @@ class HtmlTest extends MediaWikiTestCase {
                );
                $this->assertEquals(
                        ' step=any',
-                       Html::expandAttributes( array(
-                               'min' => 1,
-                               'max' => 100,
-                               'pattern' => 'abc',
-                               'required' => true,
-                               'step' => 'any'
-                       ) ,
-                       'Allow special case "step=any".'
-               ) );
+                       Html::expandAttributes(
+                               array(
+                                       'min' => 1,
+                                       'max' => 100,
+                                       'pattern' => 'abc',
+                                       'required' => true,
+                                       'step' => 'any'
+                               ),
+                               'Allow special case "step=any".'
+                       )
+               );
        }
 }
index 6a8ae87..382e3d8 100644 (file)
@@ -209,7 +209,8 @@ class XmlTest extends MediaWikiTestCase {
                        '<label for="year">From year (and earlier):</label> ' .
                                '<input id="year" maxlength="4" size="7" type="number" name="year" /> ' .
                                '<label for="month">From month (and earlier):</label> ' .
-                               '<select id="month" name="month" class="mw-month-selector"><option value="-1">all</option>' . "\n" .
+                               '<select id="month" name="month" class="mw-month-selector">' .
+                               '<option value="-1">all</option>' . "\n" .
                                '<option value="1">January</option>' . "\n" .
                                '<option value="2">February</option>' . "\n" .
                                '<option value="3">March</option>' . "\n" .
index 74219bd..8ea761f 100644 (file)
@@ -467,7 +467,7 @@ class ApiUploadTest extends ApiTestCaseUpload {
                $resultOffset = 0;
                // Open the file:
                wfSuppressWarnings();
-               $handle = @fopen( $filePath, "r" );
+               $handle = fopen( $filePath, "r" );
                wfRestoreWarnings();
 
                if ( $handle === false ) {
index 6384e3a..5a822f5 100644 (file)
@@ -30,12 +30,12 @@ class HtmlCheckMatrixTest extends MediaWikiTestCase {
        public function testValidateCallsUserDefinedValidationCallback() {
                $called = false;
                $field = new HTMLCheckMatrix( self::$defaultOptions + array(
-                               'validation-callback' => function () use ( &$called ) {
-                                               $called = true;
+                       'validation-callback' => function () use ( &$called ) {
+                               $called = true;
 
-                                               return false;
-                                       },
-                       ) );
+                               return false;
+                       },
+               ) );
                $this->assertEquals( false, $this->validate( $field, array() ) );
                $this->assertTrue( $called );
        }
index aedc23a..c61ed22 100644 (file)
@@ -32,7 +32,8 @@ class DjVuTest extends MediaWikiTestCase {
                        !$this->checkIfToolExists( $wgDjvuDump ) ||
                        !$this->checkIfToolExists( $wgDjvuToXML )
                ) {
-                       $this->markTestSkipped( 'This test needs the installation of the ddjvu, djvutoxml and djvudump tools' );
+                       $this->markTestSkipped( 'This test needs the installation of the '
+                               . 'ddjvu, djvutoxml and djvudump tools' );
                }
 
                //file repo setup
index fb3e40e..44b2070 100644 (file)
@@ -45,7 +45,9 @@ class ExifBitmapTest extends MediaWikiTestCase {
         * @covers ExifBitmapHandler::isMetadataValid
         */
        public function testGoodMetadata() {
+               // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                $meta = '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
                $res = $this->handler->isMetadataValid( null, $meta );
                $this->assertEquals( ExifBitmapHandler::METADATA_GOOD, $res );
        }
@@ -54,7 +56,9 @@ class ExifBitmapTest extends MediaWikiTestCase {
         * @covers ExifBitmapHandler::isMetadataValid
         */
        public function testIsOldGood() {
+               // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                $meta = '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:1;}';
+               // @codingStandardsIgnoreEnd
                $res = $this->handler->isMetadataValid( null, $meta );
                $this->assertEquals( ExifBitmapHandler::METADATA_COMPATIBLE, $res );
        }
@@ -64,7 +68,9 @@ class ExifBitmapTest extends MediaWikiTestCase {
         * @covers ExifBitmapHandler::isMetadataValid
         */
        public function testPagedTiffHandledGracefully() {
+               // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                $meta = 'a:6:{s:9:"page_data";a:1:{i:1;a:5:{s:5:"width";i:643;s:6:"height";i:448;s:5:"alpha";s:4:"true";s:4:"page";i:1;s:6:"pixels";i:288064;}}s:10:"page_count";i:1;s:10:"first_page";i:1;s:9:"last_page";i:1;s:4:"exif";a:9:{s:10:"ImageWidth";i:643;s:11:"ImageLength";i:448;s:11:"Compression";i:5;s:25:"PhotometricInterpretation";i:2;s:11:"Orientation";i:1;s:15:"SamplesPerPixel";i:4;s:12:"RowsPerStrip";i:50;s:19:"PlanarConfiguration";i:1;s:22:"MEDIAWIKI_EXIF_VERSION";i:1;}s:21:"TIFF_METADATA_VERSION";s:3:"1.4";}';
+               // @codingStandardsIgnoreEnd
                $res = $this->handler->isMetadataValid( null, $meta );
                $this->assertEquals( ExifBitmapHandler::METADATA_BAD, $res );
        }
index 3cfbf1a..438dc79 100644 (file)
@@ -70,8 +70,16 @@ class ExifRotationTest extends MediaWikiTestCase {
                        $file = $this->dataFile( $name, $type );
                        $thumb = $file->transform( $params, File::RENDER_NOW | File::RENDER_FORCE );
 
-                       $this->assertEquals( $out[0], $thumb->getWidth(), "$name: thumb reported width check for $size" );
-                       $this->assertEquals( $out[1], $thumb->getHeight(), "$name: thumb reported height check for $size" );
+                       $this->assertEquals(
+                               $out[0],
+                               $thumb->getWidth(),
+                               "$name: thumb reported width check for $size"
+                       );
+                       $this->assertEquals(
+                               $out[1],
+                               $thumb->getHeight(),
+                               "$name: thumb reported height check for $size"
+                       );
 
                        $gis = getimagesize( $thumb->getLocalCopyPath() );
                        if ( $out[0] > $info['width'] ) {
@@ -160,8 +168,16 @@ class ExifRotationTest extends MediaWikiTestCase {
                        $file = $this->dataFile( $name, $type );
                        $thumb = $file->transform( $params, File::RENDER_NOW | File::RENDER_FORCE );
 
-                       $this->assertEquals( $out[0], $thumb->getWidth(), "$name: thumb reported width check for $size" );
-                       $this->assertEquals( $out[1], $thumb->getHeight(), "$name: thumb reported height check for $size" );
+                       $this->assertEquals(
+                               $out[0],
+                               $thumb->getWidth(),
+                               "$name: thumb reported width check for $size"
+                       );
+                       $this->assertEquals(
+                               $out[1],
+                               $thumb->getHeight(),
+                               "$name: thumb reported height check for $size"
+                       );
 
                        $gis = getimagesize( $thumb->getLocalCopyPath() );
                        if ( $out[0] > $info['width'] ) {
index d750540..7a7ed21 100644 (file)
@@ -90,7 +90,9 @@ class GIFHandlerTest extends MediaWikiTestCase {
                        array( '', GIFHandler::METADATA_BAD ),
                        array( null, GIFHandler::METADATA_BAD ),
                        array( 'Something invalid!', GIFHandler::METADATA_BAD ),
+                       // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                        array( 'a:4:{s:10:"frameCount";i:1;s:6:"looped";b:0;s:8:"duration";d:0.1000000000000000055511151231257827021181583404541015625;s:8:"metadata";a:2:{s:14:"GIFFileComment";a:1:{i:0;s:35:"GIF test file ⁕ Created with GIMP";}s:15:"_MW_GIF_VERSION";i:1;}}', GIFHandler::METADATA_GOOD ),
+                       // @codingStandardsIgnoreEnd
                );
        }
 
@@ -108,8 +110,10 @@ class GIFHandlerTest extends MediaWikiTestCase {
 
        public static function provideGetMetadata() {
                return array(
+                       // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
                        array( 'nonanimated.gif', 'a:4:{s:10:"frameCount";i:1;s:6:"looped";b:0;s:8:"duration";d:0.1000000000000000055511151231257827021181583404541015625;s:8:"metadata";a:2:{s:14:"GIFFileComment";a:1:{i:0;s:35:"GIF test file ⁕ Created with GIMP";}s:15:"_MW_GIF_VERSION";i:1;}}' ),
                        array( 'animated-xmp.gif', 'a:4:{s:10:"frameCount";i:4;s:6:"looped";b:1;s:8:"duration";d:2.399999999999999911182158029987476766109466552734375;s:8:"metadata";a:5:{s:6:"Artist";s:7:"Bawolff";s:16:"ImageDescription";a:2:{s:9:"x-default";s:18:"A file to test GIF";s:5:"_type";s:4:"lang";}s:15:"SublocationDest";s:13:"The interwebs";s:14:"GIFFileComment";a:1:{i:0;s:16:"GIƒ·test·file";}s:15:"_MW_GIF_VERSION";i:1;}}' ),
+                       // @codingStandardsIgnoreEnd
                );
        }
 
index 81c1d28..b556a75 100644 (file)
@@ -74,7 +74,8 @@ class IPTCTest extends MediaWikiTestCase {
         */
        public function testIPTCParseUTF8() {
                // This has the magic "\x1c\x01\x5A\x00\x03\x1B\x25\x47" which marks content as UTF8.
-               $iptcData = "Photoshop 3.0\08BIM\4\4\0\0\0\0\0\x0F\x1c\x02\x19\x00\x02¼\x1c\x01\x5A\x00\x03\x1B\x25\x47";
+               $iptcData =
+                       "Photoshop 3.0\08BIM\4\4\0\0\0\0\0\x0F\x1c\x02\x19\x00\x02¼\x1c\x01\x5A\x00\x03\x1B\x25\x47";
                $res = IPTC::Parse( $iptcData );
                $this->assertEquals( array( '¼' ), $res['Keywords'] );
        }
index 7ffde3b..b10f55c 100644 (file)
@@ -70,7 +70,8 @@ class JpegMetadataExtractorTest extends MediaWikiTestCase {
 
        public function testPSIRExtraction() {
                $res = JpegMetadataExtractor::segmentSplitter( $this->filePath . 'jpeg-xmp-psir.jpg' );
-               $expected = '50686f746f73686f7020332e30003842494d04040000000000181c02190004746573741c02190003666f6f1c020000020004';
+               $expected = '50686f746f73686f7020332e30003842494d04040000000'
+                       . '000181c02190004746573741c02190003666f6f1c020000020004';
                $this->assertEquals( $expected, bin2hex( $res['PSIR'][0] ) );
        }