From 58f0a7ee4ea0bff958b43678ba7dbcc092555e2e Mon Sep 17 00:00:00 2001 From: Reedy Date: Sat, 26 Sep 2015 20:48:17 +0100 Subject: [PATCH] Wrap some long strings in tests/ Change-Id: I89d53c5051e5ee4bd8624df8ee2b25993090a7df --- tests/TestsAutoLoader.php | 9 ++++++--- tests/parser/parserTest.inc | 2 +- tests/phpunit/MediaWikiPHPUnitTestListener.php | 3 ++- .../ResourceLoaderImageModuleTest.php | 8 ++++++-- .../resourceloader/ResourceLoaderImageTest.php | 16 +++++++++++++--- .../resourceloader/ResourceLoaderModuleTest.php | 5 ++++- .../ResourceLoaderWikiModuleTest.php | 7 ++++++- 7 files changed, 38 insertions(+), 12 deletions(-) diff --git a/tests/TestsAutoLoader.php b/tests/TestsAutoLoader.php index 8a81a64447..093748d4a8 100644 --- a/tests/TestsAutoLoader.php +++ b/tests/TestsAutoLoader.php @@ -66,7 +66,8 @@ $wgAutoloadClasses += array( 'TestRecentChangesHelper' => "$testDir/phpunit/includes/changes/TestRecentChangesHelper.php", # tests/phpunit/includes/content - 'DummyContentHandlerForTesting' => "$testDir/phpunit/mocks/content/DummyContentHandlerForTesting.php", + 'DummyContentHandlerForTesting' => + "$testDir/phpunit/mocks/content/DummyContentHandlerForTesting.php", 'DummyContentForTesting' => "$testDir/phpunit/mocks/content/DummyContentForTesting.php", 'DummyNonTextContentHandler' => "$testDir/phpunit/mocks/content/DummyNonTextContentHandler.php", 'DummyNonTextContent' => "$testDir/phpunit/mocks/content/DummyNonTextContent.php", @@ -91,8 +92,10 @@ $wgAutoloadClasses += array( 'PasswordTestCase' => "$testDir/phpunit/includes/password/PasswordTestCase.php", # tests/phpunit/includes/resourceloader - 'ResourceLoaderImageModuleTest' => "$testDir/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php", - 'ResourceLoaderImageModuleTestable' => "$testDir/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php", + 'ResourceLoaderImageModuleTest' => + "$testDir/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php", + 'ResourceLoaderImageModuleTestable' => + "$testDir/phpunit/includes/resourceloader/ResourceLoaderImageModuleTest.php", # tests/phpunit/includes/specials 'SpecialPageTestBase' => "$testDir/phpunit/includes/specials/SpecialPageTestBase.php", diff --git a/tests/parser/parserTest.inc b/tests/parser/parserTest.inc index f429c30a72..0a7ebea2e8 100644 --- a/tests/parser/parserTest.inc +++ b/tests/parser/parserTest.inc @@ -729,7 +729,7 @@ class ParserTest { )* \} # Close bracket ) - (? + (? (?: (?&qstr) # Quoted val | diff --git a/tests/phpunit/MediaWikiPHPUnitTestListener.php b/tests/phpunit/MediaWikiPHPUnitTestListener.php index 08463f1259..dd606d8a4b 100644 --- a/tests/phpunit/MediaWikiPHPUnitTestListener.php +++ b/tests/phpunit/MediaWikiPHPUnitTestListener.php @@ -1,6 +1,7 @@ 'ResourceLoaderImageModule', 'selectorWithoutVariant' => '.mw-ui-icon-{name}:after, .mw-ui-icon-{name}:before', - 'selectorWithVariant' => '.mw-ui-icon-{name}-{variant}:after, .mw-ui-icon-{name}-{variant}:before', + 'selectorWithVariant' => + '.mw-ui-icon-{name}-{variant}:after, .mw-ui-icon-{name}-{variant}:before', 'variants' => self::$commonImageVariants, 'images' => self::$commonImageData, ), @@ -146,7 +147,10 @@ class ResourceLoaderImageModuleTest extends ResourceLoaderTestCase { * @covers ResourceLoaderImageModule::getStyles */ public function testGetStyles( $module, $expected ) { - $module = new ResourceLoaderImageModuleTestable( $module, __DIR__ . '/../../data/resourceloader' ); + $module = new ResourceLoaderImageModuleTestable( + $module, + __DIR__ . '/../../data/resourceloader' + ); $styles = $module->getStyles( $this->getResourceLoaderContext() ); $this->assertEquals( $expected, $styles['all'] ); } diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderImageTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderImageTest.php index cc121ba3c3..b4f1000a54 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderImageTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderImageTest.php @@ -15,9 +15,16 @@ class ResourceLoaderImageTest extends ResourceLoaderTestCase { protected function getTestImage( $name ) { $options = ResourceLoaderImageModuleTest::$commonImageData[$name]; $fileDescriptor = is_string( $options ) ? $options : $options['file']; - $allowedVariants = is_array( $options ) && isset( $options['variants'] ) ? $options['variants'] : array(); + $allowedVariants = is_array( $options ) && + isset( $options['variants'] ) ? $options['variants'] : array(); $variants = array_fill_keys( $allowedVariants, array( 'color' => 'red' ) ); - return new ResourceLoaderImageTestable( $name, 'test', $fileDescriptor, $this->imagesPath, $variants ); + return new ResourceLoaderImageTestable( + $name, + 'test', + $fileDescriptor, + $this->imagesPath, + $variants + ); } public static function provideGetPath() { @@ -86,7 +93,10 @@ class ResourceLoaderImageTest extends ResourceLoaderTestCase { $data = file_get_contents( $this->imagesPath . '/remove.svg' ); $dataConstructive = file_get_contents( $this->imagesPath . '/remove_variantize.svg' ); $this->assertEquals( $image->getImageData( $context, null, 'original' ), $data ); - $this->assertEquals( $image->getImageData( $context, 'destructive', 'original' ), $dataConstructive ); + $this->assertEquals( + $image->getImageData( $context, 'destructive', 'original' ), + $dataConstructive + ); // Stub, since we don't know if we even have a SVG handler, much less what exactly it'll output $this->assertEquals( $image->getImageData( $context, null, 'rasterized' ), 'RASTERIZESTUB' ); diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php index 41653fb035..e8ca2a3042 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderModuleTest.php @@ -75,7 +75,10 @@ class ResourceLoaderModuleTest extends ResourceLoaderTestCase { ) ); $this->assertEquals( $module->getScript( $context ), - 'mw.log.error("JavaScript parse error: Parse error: Unexpected token; token } expected in file \'input\' on line 3");', + 'mw.log.error(' . + '"JavaScript parse error: Parse error: Unexpected token; ' . + 'token } expected in file \'input\' on line 3"' . + ');', 'Replace invalid syntax with error logging' ); diff --git a/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php b/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php index 8cefec7558..49e42b4ab5 100644 --- a/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php +++ b/tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php @@ -61,7 +61,12 @@ class ResourceLoaderWikiModuleTest extends ResourceLoaderTestCase { array( $params, new HashConfig( array( 'UseSiteJs' => false ) + $settings ), array( 'MediaWiki:Common.css' => array( 'type' => 'style' ), ) ), - array( $params, new HashConfig( array( 'UseSiteJs' => false, 'UseSiteCss' => false ) ), array() ), + array( $params, + new HashConfig( + array( 'UseSiteJs' => false, 'UseSiteCss' => false ) + ), + array() + ), ); } -- 2.20.1