From c50cbe48ab6063329f92f3ab2493eb14828bb332 Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Sat, 3 Oct 2015 16:44:47 +0300 Subject: [PATCH] Fix remaining Generic.Files.LineLength failures Except the ones for which there is no clear way to fix because of T114213. Bug: T102614 Change-Id: I94a1fc7c890c82a36f0b51e42d311585c275775c --- includes/PHPVersionCheck.php | 2 ++ tests/phpunit/includes/LinkerTest.php | 2 ++ tests/phpunit/includes/WikiReferenceTest.php | 4 +++- .../includes/api/format/ApiFormatPhpTest.php | 3 ++- .../includes/api/format/ApiFormatTxtTest.php | 4 ++-- .../content/CssContentHandlerTest.php | 2 ++ tests/phpunit/includes/libs/CSSMinTest.php | 2 ++ .../includes/libs/XmlTypeCheckTest.php | 2 ++ .../libs/composer/ComposerLockTest.php | 11 +++++++--- .../logging/ProtectLogFormatterTest.php | 4 +++- tests/phpunit/includes/media/WebPTest.php | 20 +++++++++++++++---- .../LayeredParameterizedPasswordTest.php | 4 ++-- 12 files changed, 46 insertions(+), 14 deletions(-) diff --git a/includes/PHPVersionCheck.php b/includes/PHPVersionCheck.php index f7e14a1f3f..233ebf2462 100644 --- a/includes/PHPVersionCheck.php +++ b/includes/PHPVersionCheck.php @@ -188,12 +188,14 @@ function wfMissingVendorError( $type, $mwVersion ) { . "https://www.mediawiki.org/wiki/Download_from_Git#Fetch_external_libraries\n" . "for help on installing the required components."; + // @codingStandardsIgnoreStart Generic.Files.LineLength $longHtml = <<mediawiki.org for help on installing the required components. HTML; + // @codingStandardsIgnoreEnd wfGenericError( $type, $mwVersion, 'External dependencies', $shortText, $longText, $longHtml ); } diff --git a/tests/phpunit/includes/LinkerTest.php b/tests/phpunit/includes/LinkerTest.php index b8b5a77379..58634d4d8f 100644 --- a/tests/phpunit/includes/LinkerTest.php +++ b/tests/phpunit/includes/LinkerTest.php @@ -289,6 +289,7 @@ class LinkerTest extends MediaWikiLangTestCase { } public static function provideCasesForFormatLinksInComment() { + // @codingStandardsIgnoreStart Generic.Files.LineLength return array( array( 'foo bar Special:BlankPage', @@ -306,5 +307,6 @@ class LinkerTest extends MediaWikiLangTestCase { 'enwiki', ), ); + // @codingStandardsIgnoreEnd } } diff --git a/tests/phpunit/includes/WikiReferenceTest.php b/tests/phpunit/includes/WikiReferenceTest.php index 85ddafc06f..bcef403aba 100644 --- a/tests/phpunit/includes/WikiReferenceTest.php +++ b/tests/phpunit/includes/WikiReferenceTest.php @@ -85,7 +85,9 @@ class WikiReferenceTest extends PHPUnit_Framework_TestCase { /** * @dataProvider provideGetCanonicalUrl */ - public function testGetCanonicalUrl( $expected, $canonicalServer, $server, $path, $page, $fragmentId ) { + public function testGetCanonicalUrl( + $expected, $canonicalServer, $server, $path, $page, $fragmentId + ) { $reference = new WikiReference( $canonicalServer, $path, $server ); $this->assertEquals( $expected, $reference->getCanonicalUrl( $page, $fragmentId ) ); } diff --git a/tests/phpunit/includes/api/format/ApiFormatPhpTest.php b/tests/phpunit/includes/api/format/ApiFormatPhpTest.php index 745686f521..fd06ad0721 100644 --- a/tests/phpunit/includes/api/format/ApiFormatPhpTest.php +++ b/tests/phpunit/includes/api/format/ApiFormatPhpTest.php @@ -136,7 +136,8 @@ class ApiFormatPhpTest extends ApiFormatTestBase { } catch ( UsageException $ex ) { ob_end_clean(); $this->assertSame( - 'This response cannot be represented using format=php. See https://phabricator.wikimedia.org/T68776', + 'This response cannot be represented using format=php. ' . + 'See https://phabricator.wikimedia.org/T68776', $ex->getMessage(), 'Expected exception' ); diff --git a/tests/phpunit/includes/api/format/ApiFormatTxtTest.php b/tests/phpunit/includes/api/format/ApiFormatTxtTest.php index 1576c1dbb4..c779a3c0d1 100644 --- a/tests/phpunit/includes/api/format/ApiFormatTxtTest.php +++ b/tests/phpunit/includes/api/format/ApiFormatTxtTest.php @@ -9,6 +9,7 @@ class ApiFormatTxtTest extends ApiFormatTestBase { protected $printerName = 'txt'; public static function provideGeneralEncoding() { + // @codingStandardsIgnoreStart Generic.Files.LineLength $warning = "\n [warnings] => Array\n (\n [txt] => Array\n (\n" . " [*] => format=txt has been deprecated. Please use format=json instead.\n" . " )\n\n )\n"; @@ -29,7 +30,6 @@ class ApiFormatTxtTest extends ApiFormatTestBase { array( array( 'fóo' ), "Array\n({$warning}\n [0] => fóo\n)\n" ), // Arrays and objects - // @codingStandardsIgnoreStart Generic.Files.LineLength array( array( array() ), "Array\n({$warning}\n [0] => Array\n (\n )\n\n)\n" ), array( array( array( 1 ) ), "Array\n({$warning}\n [0] => Array\n (\n [0] => 1\n )\n\n)\n" ), array( array( array( 'x' => 1 ) ), "Array\n({$warning}\n [0] => Array\n (\n [x] => 1\n )\n\n)\n" ), @@ -50,8 +50,8 @@ class ApiFormatTxtTest extends ApiFormatTestBase { // BC Subelements array( array( 'foo' => 'foo', ApiResult::META_BC_SUBELEMENTS => array( 'foo' ) ), "Array\n({$warning}\n [foo] => Array\n (\n [*] => foo\n )\n\n)\n" ), - // @codingStandardsIgnoreEnd ); + // @codingStandardsIgnoreEnd } } diff --git a/tests/phpunit/includes/content/CssContentHandlerTest.php b/tests/phpunit/includes/content/CssContentHandlerTest.php index e1785a961b..58735bcefb 100644 --- a/tests/phpunit/includes/content/CssContentHandlerTest.php +++ b/tests/phpunit/includes/content/CssContentHandlerTest.php @@ -21,10 +21,12 @@ class CssContentHandlerTest extends MediaWikiTestCase { * Keep this in sync with CssContentTest::provideGetRedirectTarget() */ public static function provideMakeRedirectContent() { + // @codingStandardsIgnoreStart Generic.Files.LineLength return array( array( 'MediaWiki:MonoBook.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=MediaWiki:MonoBook.css&action=raw&ctype=text/css);" ), array( 'User:FooBar/common.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=User:FooBar/common.css&action=raw&ctype=text/css);" ), array( 'Gadget:FooBaz.css', "/* #REDIRECT */@import url(//example.org/w/index.php?title=Gadget:FooBaz.css&action=raw&ctype=text/css);" ), ); + // @codingStandardsIgnoreEnd } } diff --git a/tests/phpunit/includes/libs/CSSMinTest.php b/tests/phpunit/includes/libs/CSSMinTest.php index 7841f30f48..f4f7bfdd4a 100644 --- a/tests/phpunit/includes/libs/CSSMinTest.php +++ b/tests/phpunit/includes/libs/CSSMinTest.php @@ -188,6 +188,7 @@ class CSSMinTest extends MediaWikiTestCase { . '%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%228%22%20height%3D' . '%228%22%3E%0A%3Ccircle%20cx%3D%224%22%20cy%3D%224%22%20r%3D%222%22%2F%3E%0A%3C%2Fsvg%3E%0A'; + // @codingStandardsIgnoreStart Generic.Files.LineLength return array( array( 'Regular file', @@ -374,6 +375,7 @@ class CSSMinTest extends MediaWikiTestCase { '.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(http://localhost/w/images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }', ), ); + // @codingStandardsIgnoreEnd } /** diff --git a/tests/phpunit/includes/libs/XmlTypeCheckTest.php b/tests/phpunit/includes/libs/XmlTypeCheckTest.php index f0ba934e0b..c43d550a74 100644 --- a/tests/phpunit/includes/libs/XmlTypeCheckTest.php +++ b/tests/phpunit/includes/libs/XmlTypeCheckTest.php @@ -8,7 +8,9 @@ class XmlTypeCheckTest extends PHPUnit_Framework_TestCase { const WELL_FORMED_XML = ""; const MAL_FORMED_XML = ""; + // @codingStandardsIgnoreStart Generic.Files.LineLength const XML_WITH_PIH = ''; + // @codingStandardsIgnoreEnd /** * @covers XMLTypeCheck::newFromString diff --git a/tests/phpunit/includes/libs/composer/ComposerLockTest.php b/tests/phpunit/includes/libs/composer/ComposerLockTest.php index cac3b10145..6b374f2539 100644 --- a/tests/phpunit/includes/libs/composer/ComposerLockTest.php +++ b/tests/phpunit/includes/libs/composer/ComposerLockTest.php @@ -38,7 +38,8 @@ class ComposerLockTest extends MediaWikiTestCase { 'email' => 'chad@wikimedia.org', ), ), - 'description' => 'Constant Database (CDB) wrapper library for PHP. Provides pure-PHP fallback when dba_* functions are absent.', + 'description' => 'Constant Database (CDB) wrapper library for PHP. '. + 'Provides pure-PHP fallback when dba_* functions are absent.', ), 'cssjanus/cssjanus' => array( 'version' => '1.1.1', @@ -108,14 +109,18 @@ class ComposerLockTest extends MediaWikiTestCase { 'role' => 'Developer', ), ), - 'description' => 'The only standard solution to translate any kind of text with an avant-garde web interface within MediaWiki, including your documentation and software', + 'description' => 'The only standard solution to translate any kind ' . + 'of text with an avant-garde web interface within MediaWiki, ' . + 'including your documentation and software', ), 'mediawiki/universal-language-selector' => array( 'version' => '2014.12', 'type' => 'mediawiki-extension', 'licenses' => array( 'GPL-2.0+', 'MIT' ), 'authors' => array(), - 'description' => 'The primary aim is to allow users to select a language and configure its support in an easy way. Main features are language selection, input methods and web fonts.', + 'description' => 'The primary aim is to allow users to select a language ' . + 'and configure its support in an easy way. ' . + 'Main features are language selection, input methods and web fonts.', ), ), $lock->getInstalledDependencies(), false, true ); } diff --git a/tests/phpunit/includes/logging/ProtectLogFormatterTest.php b/tests/phpunit/includes/logging/ProtectLogFormatterTest.php index 558c0fd547..17decf36fa 100644 --- a/tests/phpunit/includes/logging/ProtectLogFormatterTest.php +++ b/tests/phpunit/includes/logging/ProtectLogFormatterTest.php @@ -255,7 +255,9 @@ class ProtectLogFormatterTest extends LogFormatterTestCase { ), ), array( - 'text' => 'User changed protection level for ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite) [cascading]', + 'text' => 'User changed protection level for ProtectPage ' . + '[Edit=Allow only administrators] (indefinite) ' . + '[Move=Allow only administrators] (indefinite) [cascading]', 'api' => array( 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)', 'cascade' => true, diff --git a/tests/phpunit/includes/media/WebPTest.php b/tests/phpunit/includes/media/WebPTest.php index b6d41147e2..a92f25ac62 100644 --- a/tests/phpunit/includes/media/WebPTest.php +++ b/tests/phpunit/includes/media/WebPTest.php @@ -78,10 +78,22 @@ class WebPHandlerTest extends MediaWikiTestCase { } public function provideTestWithFileExtractMetaData() { return array( - array( __DIR__ . '/../../data/media/2_webp_ll.webp', - array( 'compression' => 'lossless', 'width' => 386, 'height' => 395 ) ), - array( __DIR__ . '/../../data/media/2_webp_a.webp', - array( 'compression' => 'lossy', 'animated' => false, 'transparency' => true, 'width' => 386, 'height' => 395 ) ), + array( __DIR__ . '/../../data/media/2_webp_ll.webp', + array( + 'compression' => 'lossless', + 'width' => 386, + 'height' => 395 + ) + ), + array( __DIR__ . '/../../data/media/2_webp_a.webp', + array( + 'compression' => 'lossy', + 'animated' => false, + 'transparency' => true, + 'width' => 386, + 'height' => 395 + ) + ), ); } diff --git a/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php b/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php index 86e8270a32..368fda14f3 100644 --- a/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php +++ b/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php @@ -27,11 +27,11 @@ class LayeredParameterizedPasswordTest extends PasswordTestCase { } public static function providePasswordTests() { - /** @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong */ + // @codingStandardsIgnoreStart Generic.Files.LineLength.TooLong return array( array( true, ':testLargeLayeredTop:sha512:1024:512!sha512:1024:512!sha512:1024:512!sha512:1024:512!5!vnRy+2SrSA0fHt3dwhTP5g==!AVnwfZsAQjn+gULv7FSGjA==!xvHUX3WcpkeSn1lvjWcvBg==!It+OC/N9tu+d3ByHhuB0BQ==!Tb.gqUOiD.aWktVwHM.Q/O!7CcyMfXUPky5ptyATJsR2nq3vUqtnBC', 'testPassword123' ), ); - /** @codingStandardsIgnoreEnd */ + // @codingStandardsIgnoreEnd } /** -- 2.20.1