From bfdd3369c26b10307c7e6f428aa03e2b38b9ec1d Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Sat, 3 Oct 2015 16:04:51 +0300 Subject: [PATCH] Fix Generic.Files.LineLength phpcs check in files under phpunit/includes Bug: T102614 Change-Id: Iee3df5f064f595ecebe8210cc936bc3d20a122c9 --- tests/phpunit/includes/ImportTest.php | 14 ++++++++++++-- tests/phpunit/includes/LinkerTest.php | 2 ++ tests/phpunit/includes/TestUser.php | 4 +++- .../changes/TestRecentChangesHelper.php | 4 ++-- .../includes/logging/LogFormatterTest.php | 6 ++++-- .../logging/ProtectLogFormatterTest.php | 19 +++++++++++++------ .../phpunit/includes/mail/MailAddressTest.php | 12 +++++++++--- tests/phpunit/includes/media/WebPTest.php | 2 ++ .../registration/ExtensionProcessorTest.php | 14 +++++++++++--- .../includes/upload/UploadBaseTest.php | 2 ++ 10 files changed, 60 insertions(+), 19 deletions(-) diff --git a/tests/phpunit/includes/ImportTest.php b/tests/phpunit/includes/ImportTest.php index 7ef44e790b..8ee2ad5aca 100644 --- a/tests/phpunit/includes/ImportTest.php +++ b/tests/phpunit/includes/ImportTest.php @@ -38,7 +38,10 @@ class ImportTest extends MediaWikiLangTestCase { } }; - $importer = new WikiImporter( $source, ConfigFactory::getDefaultInstance()->makeConfig( 'main' ) ); + $importer = new WikiImporter( + $source, + ConfigFactory::getDefaultInstance()->makeConfig( 'main' ) + ); $importer->setPageOutCallback( $callback ); $importer->doImport(); @@ -46,6 +49,7 @@ class ImportTest extends MediaWikiLangTestCase { } public function getRedirectXML() { + // @codingStandardsIgnoreStart Generic.Files.LineLength return array( array( <<< EOF @@ -100,6 +104,7 @@ EOF null ), ); + // @codingStandardsIgnoreEnd } /** @@ -116,7 +121,10 @@ EOF $importNamespaces = $siteinfo['_namespaces']; }; - $importer = new WikiImporter( $source, ConfigFactory::getDefaultInstance()->makeConfig( 'main' ) ); + $importer = new WikiImporter( + $source, + ConfigFactory::getDefaultInstance()->makeConfig( 'main' ) + ); $importer->setSiteInfoCallback( $callback ); $importer->doImport(); @@ -124,6 +132,7 @@ EOF } public function getSiteInfoXML() { + // @codingStandardsIgnoreStart Generic.Files.LineLength return array( array( <<< EOF @@ -155,6 +164,7 @@ EOF ) ), ); + // @codingStandardsIgnoreEnd } } diff --git a/tests/phpunit/includes/LinkerTest.php b/tests/phpunit/includes/LinkerTest.php index 19ab56f80b..b8b5a77379 100644 --- a/tests/phpunit/includes/LinkerTest.php +++ b/tests/phpunit/includes/LinkerTest.php @@ -131,6 +131,7 @@ class LinkerTest extends MediaWikiLangTestCase { public function provideCasesForFormatComment() { $wikiId = 'enwiki'; // $wgConf has a fake entry for this + // @codingStandardsIgnoreStart Generic.Files.LineLength return array( // Linker::formatComment array( @@ -254,6 +255,7 @@ class LinkerTest extends MediaWikiLangTestCase { false, false, $wikiId ) ); + // @codingStandardsIgnoreEnd } /** diff --git a/tests/phpunit/includes/TestUser.php b/tests/phpunit/includes/TestUser.php index 754568d0b2..96b2251d3c 100644 --- a/tests/phpunit/includes/TestUser.php +++ b/tests/phpunit/includes/TestUser.php @@ -28,7 +28,9 @@ class TestUser { private function assertNotReal() { global $wgDBprefix; - if ( $wgDBprefix !== MediaWikiTestCase::DB_PREFIX && $wgDBprefix !== MediaWikiTestCase::ORA_DB_PREFIX ) { + if ( $wgDBprefix !== MediaWikiTestCase::DB_PREFIX && + $wgDBprefix !== MediaWikiTestCase::ORA_DB_PREFIX + ) { throw new MWException( "Can't create user on real database" ); } } diff --git a/tests/phpunit/includes/changes/TestRecentChangesHelper.php b/tests/phpunit/includes/changes/TestRecentChangesHelper.php index 2506087bfa..fe5bdd2674 100644 --- a/tests/phpunit/includes/changes/TestRecentChangesHelper.php +++ b/tests/phpunit/includes/changes/TestRecentChangesHelper.php @@ -25,8 +25,8 @@ class TestRecentChangesHelper { return $this->makeRecentChange( $attribs, $counter, $watchingUsers ); } - public function makeLogRecentChange( $logType, $logAction, User $user, $titleText, $timestamp, $counter, - $watchingUsers + public function makeLogRecentChange( + $logType, $logAction, User $user, $titleText, $timestamp, $counter, $watchingUsers ) { $attribs = array_merge( $this->getDefaultAttributes( $titleText, $timestamp ), diff --git a/tests/phpunit/includes/logging/LogFormatterTest.php b/tests/phpunit/includes/logging/LogFormatterTest.php index 1816708a6e..478086b288 100644 --- a/tests/phpunit/includes/logging/LogFormatterTest.php +++ b/tests/phpunit/includes/logging/LogFormatterTest.php @@ -523,8 +523,10 @@ class LogFormatterTest extends MediaWikiLangTestCase { # protect/modify $this->assertIRCComment( - $this->context->msg( 'modifiedarticleprotection', 'SomeTitle ' . $protectParams['4::description'] ) - ->plain() . $sep . $this->user_comment, + $this->context->msg( + 'modifiedarticleprotection', + 'SomeTitle ' . $protectParams['4::description'] + )->plain() . $sep . $this->user_comment, 'protect', 'modify', $protectParams, $this->user_comment diff --git a/tests/phpunit/includes/logging/ProtectLogFormatterTest.php b/tests/phpunit/includes/logging/ProtectLogFormatterTest.php index 718c08c43a..558c0fd547 100644 --- a/tests/phpunit/includes/logging/ProtectLogFormatterTest.php +++ b/tests/phpunit/includes/logging/ProtectLogFormatterTest.php @@ -37,7 +37,8 @@ class ProtectLogFormatterTest extends LogFormatterTestCase { ), ), array( - 'text' => 'User protected ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)', + 'text' => 'User protected ProtectPage [Edit=Allow only administrators] ' . + '(indefinite) [Move=Allow only administrators] (indefinite)', 'api' => array( 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)', 'cascade' => false, @@ -87,7 +88,8 @@ class ProtectLogFormatterTest extends LogFormatterTestCase { ), ), array( - 'text' => 'User protected ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite) [cascading]', + 'text' => 'User protected ProtectPage [Edit=Allow only administrators] ' . + '(indefinite) [Move=Allow only administrators] (indefinite) [cascading]', 'api' => array( 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)', 'cascade' => true, @@ -147,7 +149,8 @@ class ProtectLogFormatterTest extends LogFormatterTestCase { ), array( 'legacy' => true, - 'text' => 'User protected ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite) [cascading]', + 'text' => 'User protected ProtectPage [edit=sysop] ' . + '(indefinite)[move=sysop] (indefinite) [cascading]', 'api' => array( 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)', 'cascade' => true, @@ -200,7 +203,9 @@ class ProtectLogFormatterTest extends LogFormatterTestCase { ), ), array( - 'text' => 'User changed protection level for ProtectPage [Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)', + 'text' => 'User changed protection level for ProtectPage ' . + '[Edit=Allow only administrators] ' . + '(indefinite) [Move=Allow only administrators] (indefinite)', 'api' => array( 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)', 'cascade' => false, @@ -287,7 +292,8 @@ class ProtectLogFormatterTest extends LogFormatterTestCase { ), array( 'legacy' => true, - 'text' => 'User changed protection level for ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite)', + 'text' => 'User changed protection level for ProtectPage ' . + '[edit=sysop] (indefinite)[move=sysop] (indefinite)', 'api' => array( 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)', 'cascade' => false, @@ -310,7 +316,8 @@ class ProtectLogFormatterTest extends LogFormatterTestCase { ), array( 'legacy' => true, - 'text' => 'User changed protection level for ProtectPage [edit=sysop] (indefinite)[move=sysop] (indefinite) [cascading]', + 'text' => 'User changed protection level for ProtectPage ' . + '[edit=sysop] (indefinite)[move=sysop] (indefinite) [cascading]', 'api' => array( 'description' => '[edit=sysop] (indefinite)[move=sysop] (indefinite)', 'cascade' => true, diff --git a/tests/phpunit/includes/mail/MailAddressTest.php b/tests/phpunit/includes/mail/MailAddressTest.php index 18d2acdf38..1fc63d901f 100644 --- a/tests/phpunit/includes/mail/MailAddressTest.php +++ b/tests/phpunit/includes/mail/MailAddressTest.php @@ -18,9 +18,15 @@ class MailAddressTest extends MediaWikiTestCase { $this->markTestSkipped( 'This test only works on non-Windows platforms' ); } $user = $this->getMock( 'User' ); - $user->expects( $this->any() )->method( 'getName' )->will( $this->returnValue( 'UserName' ) ); - $user->expects( $this->any() )->method( 'getEmail' )->will( $this->returnValue( 'foo@bar.baz' ) ); - $user->expects( $this->any() )->method( 'getRealName' )->will( $this->returnValue( 'Real name' ) ); + $user->expects( $this->any() )->method( 'getName' )->will( + $this->returnValue( 'UserName' ) + ); + $user->expects( $this->any() )->method( 'getEmail' )->will( + $this->returnValue( 'foo@bar.baz' ) + ); + $user->expects( $this->any() )->method( 'getRealName' )->will( + $this->returnValue( 'Real name' ) + ); $ma = MailAddress::newFromUser( $user ); $this->assertInstanceOf( 'MailAddress', $ma ); diff --git a/tests/phpunit/includes/media/WebPTest.php b/tests/phpunit/includes/media/WebPTest.php index 285f28028d..b6d41147e2 100644 --- a/tests/phpunit/includes/media/WebPTest.php +++ b/tests/phpunit/includes/media/WebPTest.php @@ -19,6 +19,7 @@ class WebPHandlerTest extends MediaWikiTestCase { $this->assertEquals( $expectedResult, WebPHandler::extractMetadata( $this->tempFileName ) ); } public function provideTestExtractMetaData() { + // @codingStandardsIgnoreStart Generic.Files.LineLength return array( // Files from https://developers.google.com/speed/webp/gallery2 array( "\x52\x49\x46\x46\x90\x68\x01\x00\x57\x45\x42\x50\x56\x50\x38\x4C\x83\x68\x01\x00\x2F\x8F\x01\x4B\x10\x8D\x38\x6C\xDB\x46\x92\xE0\xE0\x82\x7B\x6C", @@ -66,6 +67,7 @@ class WebPHandlerTest extends MediaWikiTestCase { array( 'RIFF1234WEBPVP8 ', false ), array( 'RIFF1234WEBPVP8L ', false ), ); + // @codingStandardsIgnoreEnd } /** diff --git a/tests/phpunit/includes/registration/ExtensionProcessorTest.php b/tests/phpunit/includes/registration/ExtensionProcessorTest.php index 1cb8a5d964..ddf552ef0d 100644 --- a/tests/phpunit/includes/registration/ExtensionProcessorTest.php +++ b/tests/phpunit/includes/registration/ExtensionProcessorTest.php @@ -379,13 +379,21 @@ class ExtensionProcessorTest extends MediaWikiTestCase { array( array( 'wgGroupPermissions' ), array( - 'wgGroupPermissions' => array( 'sysop' => array( 'delete' ) ), + 'wgGroupPermissions' => array( + 'sysop' => array( 'delete' ) + ), ), array( - 'GroupPermissions' => array( 'sysop' => array( 'undelete' ), 'user' => array( 'edit' ) ), + 'GroupPermissions' => array( + 'sysop' => array( 'undelete' ), + 'user' => array( 'edit' ) + ), ), array( - 'wgGroupPermissions' => array( 'sysop' => array( 'delete', 'undelete' ), 'user' => array( 'edit' ) ), + 'wgGroupPermissions' => array( + 'sysop' => array( 'delete', 'undelete' ), + 'user' => array( 'edit' ) + ), ) ) ); diff --git a/tests/phpunit/includes/upload/UploadBaseTest.php b/tests/phpunit/includes/upload/UploadBaseTest.php index 9441b77fa1..9ec1b4667b 100644 --- a/tests/phpunit/includes/upload/UploadBaseTest.php +++ b/tests/phpunit/includes/upload/UploadBaseTest.php @@ -136,6 +136,7 @@ class UploadBaseTest extends MediaWikiTestCase { } public static function provideCheckSvgScriptCallback() { + // @codingStandardsIgnoreStart Generic.Files.LineLength return array( // html5sec SVG vectors array( @@ -389,6 +390,7 @@ class UploadBaseTest extends MediaWikiTestCase { 'SVG with local urls, including filter: in style' ), ); + // @codingStandardsIgnoreEnd } } -- 2.20.1