From: Siebrand Mazeland Date: Thu, 24 Apr 2014 17:51:33 +0000 (+0200) Subject: Pass phpcs-strict on some test files (8/11) X-Git-Tag: 1.31.0-rc.0~16023^2 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=e1d58d90711b486cd48fa0cb0c183066798c3867;p=lhc%2Fweb%2Fwiklou.git Pass phpcs-strict on some test files (8/11) Change-Id: I138c1f9bf2c3c7e9218d5fa29365e78b309fb459 --- diff --git a/tests/phpunit/includes/HtmlTest.php b/tests/phpunit/includes/HtmlTest.php index f112a0080e..e9349656be 100644 --- a/tests/phpunit/includes/HtmlTest.php +++ b/tests/phpunit/includes/HtmlTest.php @@ -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".' + ) + ); } } diff --git a/tests/phpunit/includes/XmlTest.php b/tests/phpunit/includes/XmlTest.php index 6a8ae87a7e..382e3d89b5 100644 --- a/tests/phpunit/includes/XmlTest.php +++ b/tests/phpunit/includes/XmlTest.php @@ -209,7 +209,8 @@ class XmlTest extends MediaWikiTestCase { ' ' . ' ' . ' ' . - '' . + '' . "\n" . '' . "\n" . '' . "\n" . '' . "\n" . diff --git a/tests/phpunit/includes/api/ApiUploadTest.php b/tests/phpunit/includes/api/ApiUploadTest.php index 74219bddd4..8ea761f8a7 100644 --- a/tests/phpunit/includes/api/ApiUploadTest.php +++ b/tests/phpunit/includes/api/ApiUploadTest.php @@ -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 ) { diff --git a/tests/phpunit/includes/htmlform/HTMLCheckMatrixTest.php b/tests/phpunit/includes/htmlform/HTMLCheckMatrixTest.php index 6384e3a419..5a822f5318 100644 --- a/tests/phpunit/includes/htmlform/HTMLCheckMatrixTest.php +++ b/tests/phpunit/includes/htmlform/HTMLCheckMatrixTest.php @@ -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 ); } diff --git a/tests/phpunit/includes/media/DjVuTest.php b/tests/phpunit/includes/media/DjVuTest.php index aedc23ad8e..c61ed22ad5 100644 --- a/tests/phpunit/includes/media/DjVuTest.php +++ b/tests/phpunit/includes/media/DjVuTest.php @@ -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 diff --git a/tests/phpunit/includes/media/ExifBitmapTest.php b/tests/phpunit/includes/media/ExifBitmapTest.php index fb3e40eb6d..44b20702bf 100644 --- a/tests/phpunit/includes/media/ExifBitmapTest.php +++ b/tests/phpunit/includes/media/ExifBitmapTest.php @@ -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 ); } diff --git a/tests/phpunit/includes/media/ExifRotationTest.php b/tests/phpunit/includes/media/ExifRotationTest.php index 3cfbf1abaa..438dc79ea9 100644 --- a/tests/phpunit/includes/media/ExifRotationTest.php +++ b/tests/phpunit/includes/media/ExifRotationTest.php @@ -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'] ) { diff --git a/tests/phpunit/includes/media/GIFTest.php b/tests/phpunit/includes/media/GIFTest.php index d7505409de..7a7ed217e8 100644 --- a/tests/phpunit/includes/media/GIFTest.php +++ b/tests/phpunit/includes/media/GIFTest.php @@ -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 ); } diff --git a/tests/phpunit/includes/media/IPTCTest.php b/tests/phpunit/includes/media/IPTCTest.php index 81c1d2878f..b556a75876 100644 --- a/tests/phpunit/includes/media/IPTCTest.php +++ b/tests/phpunit/includes/media/IPTCTest.php @@ -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'] ); } diff --git a/tests/phpunit/includes/media/JpegMetadataExtractorTest.php b/tests/phpunit/includes/media/JpegMetadataExtractorTest.php index 7ffde3b0e5..b10f55c88d 100644 --- a/tests/phpunit/includes/media/JpegMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/JpegMetadataExtractorTest.php @@ -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] ) ); }