From f3524224f03e41f4ad309f8704a82df72db11878 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Sun, 10 Mar 2024 23:26:24 +0100 Subject: build: Fix line indents Fixed SkinModuleTest::provideGetFeatureFilePathsOrder as nesting of arrays for parameters is wrong Change-Id: I9875008adf62d284c48662ebfbd245d72e5be064 --- .../includes/ExternalLinks/LinkFilterTest.php | 4 +- .../includes/ResourceLoader/ResourceLoaderTest.php | 2 +- .../includes/ResourceLoader/SkinModuleTest.php | 108 ++++++++++----------- .../preferences/DefaultPreferencesFactoryTest.php | 23 +++-- .../includes/specials/SpecialContributionsTest.php | 2 +- .../includes/specials/SpecialSearchTest.php | 10 +- .../includes/Rest/Handler/UpdateHandlerTest.php | 2 +- tests/phpunit/unit/includes/Rest/RouterTest.php | 4 +- .../libs/ParamValidator/TypeDef/EnumDefTest.php | 10 +- 9 files changed, 85 insertions(+), 80 deletions(-) (limited to 'tests') diff --git a/tests/phpunit/includes/ExternalLinks/LinkFilterTest.php b/tests/phpunit/includes/ExternalLinks/LinkFilterTest.php index ecc90d4470d3..3913af4e43cc 100644 --- a/tests/phpunit/includes/ExternalLinks/LinkFilterTest.php +++ b/tests/phpunit/includes/ExternalLinks/LinkFilterTest.php @@ -293,7 +293,7 @@ class LinkFilterTest extends MediaWikiLangTestCase { 'mailto:', '//', 'file://', # Non-default - ] ); + ] ); $index = LinkFilter::makeIndexes( $url ); $this->assertEquals( $expected, $index, "LinkFilter::makeIndexes(\"$url\")" ); @@ -390,7 +390,7 @@ class LinkFilterTest extends MediaWikiLangTestCase { 'mailto:', '//', 'file://', # Non-default - ] ); + ] ); $index = LinkFilter::reverseIndexes( $url ); $this->assertEquals( $expected, $index, "LinkFilter::reverseIndexe(\"$url\")" ); diff --git a/tests/phpunit/includes/ResourceLoader/ResourceLoaderTest.php b/tests/phpunit/includes/ResourceLoader/ResourceLoaderTest.php index 25114e626b14..5472570d0f24 100644 --- a/tests/phpunit/includes/ResourceLoader/ResourceLoaderTest.php +++ b/tests/phpunit/includes/ResourceLoader/ResourceLoaderTest.php @@ -1265,7 +1265,7 @@ mw.foo() mw.foo() mw.loader.state({"test1":"ready","test2":"ready"}); JS - ); + ); $rl->respond( $context ); $extraHeaders = TestingAccessWrapper::newFromObject( $rl )->extraHeaders; diff --git a/tests/phpunit/includes/ResourceLoader/SkinModuleTest.php b/tests/phpunit/includes/ResourceLoader/SkinModuleTest.php index 04a75ff88067..0aca4c8f248b 100644 --- a/tests/phpunit/includes/ResourceLoader/SkinModuleTest.php +++ b/tests/phpunit/includes/ResourceLoader/SkinModuleTest.php @@ -535,69 +535,69 @@ class SkinModuleTest extends ResourceLoaderTestCase { public static function provideGetFeatureFilePathsOrder() { return [ + [ + 'The "logo" skin-feature is loaded when the "features" key is absent', + [], [ - 'The "logo" skin-feature is loaded when the "features" key is absent', - [], - [ - 'all' => [ self::getSkinFeaturePath( 'logo', 'all' ) ], - 'print' => [ self::getSkinFeaturePath( 'logo', 'print' ) ], - ], + 'all' => [ self::getSkinFeaturePath( 'logo', 'all' ) ], + 'print' => [ self::getSkinFeaturePath( 'logo', 'print' ) ], ], + ], + [ + 'The "normalize" skin-feature is always output first', [ - 'The "normalize" skin-feature is always output first', - [ - 'features' => [ 'elements', 'normalize' ], - ], - [ - 'all' => [ self::getSkinFeaturePath( 'normalize', 'all' ) ], - 'screen' => [ self::getSkinFeaturePath( 'elements', 'screen' ) ], - 'print' => [ self::getSkinFeaturePath( 'elements', 'print' ) ], - ], + 'features' => [ 'elements', 'normalize' ], + ], [ - 'Empty media query blocks are not included in output', - [ - 'features' => [ - 'accessibility' => false, - 'content-body' => false, - 'interface-core' => false, - 'toc' => false - ], - ], - [ - '' => [ '' ], + 'all' => [ self::getSkinFeaturePath( 'normalize', 'all' ) ], + 'screen' => [ self::getSkinFeaturePath( 'elements', 'screen' ) ], + 'print' => [ self::getSkinFeaturePath( 'elements', 'print' ) ], + ], + ], + [ + 'Empty media query blocks are not included in output', + [ + 'features' => [ + 'accessibility' => false, + 'content-body' => false, + 'interface-core' => false, + 'toc' => false ], ], - [ 'Empty "features" key outputs default skin-features', - [ - 'features' => [], + [], + ], + [ + 'Empty "features" key outputs default skin-features', + [ + 'features' => [], + ], + [ + 'all' => [ + self::getSkinFeaturePath( 'accessibility', 'all' ), + self::getSkinFeaturePath( 'toc', 'all' ) ], - [ - 'all' => [ - self::getSkinFeaturePath( 'accessibility', 'all' ), - self::getSkinFeaturePath( 'toc', 'all' ) - ], - 'screen' => [ - self::getSkinFeaturePath( 'content-body', 'screen' ), - self::getSkinFeaturePath( 'interface-core', 'screen' ), - self::getSkinFeaturePath( 'toc', 'screen' ), - ], - 'print' => [ - self::getSkinFeaturePath( 'content-body', 'print' ), - self::getSkinFeaturePath( 'interface-core', 'print' ), - self::getSkinFeaturePath( 'toc', 'print' ) - ] + 'screen' => [ + self::getSkinFeaturePath( 'content-body', 'screen' ), + self::getSkinFeaturePath( 'interface-core', 'screen' ), + self::getSkinFeaturePath( 'toc', 'screen' ), ], + 'print' => [ + self::getSkinFeaturePath( 'content-body', 'print' ), + self::getSkinFeaturePath( 'interface-core', 'print' ), + self::getSkinFeaturePath( 'toc', 'print' ) + ] ], - [ 'skin-features are output in the order defined in SkinModule.php', - [ - 'features' => [ 'interface-message-box', 'normalize', 'accessibility' ], - ], - [ - 'all' => [ - self::getSkinFeaturePath( 'accessibility', 'all' ), - self::getSkinFeaturePath( 'normalize', 'all' ), - self::getSkinFeaturePath( 'interface-message-box', 'all' ) - ], + ], + [ + 'skin-features are output in the order defined in SkinModule.php', + [ + 'features' => [ 'interface-message-box', 'normalize', 'accessibility' ], + ], + [ + 'all' => [ + self::getSkinFeaturePath( 'accessibility', 'all' ), + self::getSkinFeaturePath( 'normalize', 'all' ), + self::getSkinFeaturePath( 'interface-message-box', 'all' ) ], ] ] diff --git a/tests/phpunit/includes/preferences/DefaultPreferencesFactoryTest.php b/tests/phpunit/includes/preferences/DefaultPreferencesFactoryTest.php index be9c4631d285..fadacc168522 100644 --- a/tests/phpunit/includes/preferences/DefaultPreferencesFactoryTest.php +++ b/tests/phpunit/includes/preferences/DefaultPreferencesFactoryTest.php @@ -358,16 +358,19 @@ class DefaultPreferencesFactoryTest extends \MediaWikiIntegrationTestCase { ->willReturn( $this->context ); $this->setTemporaryHook( 'PreferencesFormPreSave', - function ( $formData, $form, $user, &$result, $oldUserOptions ) - use ( $newOptions, $oldOptions, $userMock ) { - $this->assertSame( $userMock, $user ); - foreach ( $newOptions as $option => $value ) { - $this->assertSame( $value, $formData[ $option ] ); - } - foreach ( $oldOptions as $option => $value ) { - $this->assertSame( $value, $oldUserOptions[ $option ] ); - } - $this->assertTrue( $result ); + function ( + $formData, $form, $user, &$result, $oldUserOptions + ) use ( + $newOptions, $oldOptions, $userMock + ) { + $this->assertSame( $userMock, $user ); + foreach ( $newOptions as $option => $value ) { + $this->assertSame( $value, $formData[ $option ] ); + } + foreach ( $oldOptions as $option => $value ) { + $this->assertSame( $value, $oldUserOptions[ $option ] ); + } + $this->assertTrue( $result ); } ); diff --git a/tests/phpunit/includes/specials/SpecialContributionsTest.php b/tests/phpunit/includes/specials/SpecialContributionsTest.php index 2b05927baac9..33bc4630c98f 100644 --- a/tests/phpunit/includes/specials/SpecialContributionsTest.php +++ b/tests/phpunit/includes/specials/SpecialContributionsTest.php @@ -114,7 +114,7 @@ class SpecialContributionsTest extends SpecialPageTestBase { new FauxRequest( [ 'year' => $year, 'month' => $month, - ] ) ); + ] ) ); if ( $expect ) { $this->assertStringContainsString( $this->pageName, $html ); } else { diff --git a/tests/phpunit/includes/specials/SpecialSearchTest.php b/tests/phpunit/includes/specials/SpecialSearchTest.php index 1455f2865feb..7f20bb0fb885 100644 --- a/tests/phpunit/includes/specials/SpecialSearchTest.php +++ b/tests/phpunit/includes/specials/SpecialSearchTest.php @@ -149,11 +149,11 @@ class SpecialSearchTest extends MediaWikiIntegrationTestCase { ], [ $EMPTY_REQUEST, [ - 'searchNs2' => 1, - 'searchNs14' => 1, - ] + array_fill_keys( array_map( static function ( $ns ) { - return "searchNs$ns"; - }, $defaultNS ), 0 ), + 'searchNs2' => 1, + 'searchNs14' => 1, + ] + array_fill_keys( array_map( static function ( $ns ) { + return "searchNs$ns"; + }, $defaultNS ), 0 ), 'advanced', [ 2, 14 ], 'T35583: search with no option should honor User search preferences' . ' and have all other namespace disabled' diff --git a/tests/phpunit/integration/includes/Rest/Handler/UpdateHandlerTest.php b/tests/phpunit/integration/includes/Rest/Handler/UpdateHandlerTest.php index 0e4a00c95130..8e28eefa4821 100644 --- a/tests/phpunit/integration/includes/Rest/Handler/UpdateHandlerTest.php +++ b/tests/phpunit/integration/includes/Rest/Handler/UpdateHandlerTest.php @@ -394,7 +394,7 @@ class UpdateHandlerTest extends MediaWikiLangTestCase { "title" => "Foo", "contentmodel" => "wikitext", "nochange" => "", // null-edit! - ] + ] ], [ // Response expected to be generated by UpdateHandler 'id' => 94542, diff --git a/tests/phpunit/unit/includes/Rest/RouterTest.php b/tests/phpunit/unit/includes/Rest/RouterTest.php index 7aa0daa4c94f..12a83cdfbd91 100644 --- a/tests/phpunit/unit/includes/Rest/RouterTest.php +++ b/tests/phpunit/unit/includes/Rest/RouterTest.php @@ -398,7 +398,7 @@ class RouterTest extends MediaWikiUnitTestCase { $this->assertSame( 415, $response->getStatusCode() ); } - public function testDeleteRequestWithoutBody() { + public function testDeleteRequestWithoutBody() { // Test DELETE request without body $requestWithoutBody = new RequestData( [ 'uri' => new Uri( '/rest/mock/RouterTest/echo' ), @@ -407,7 +407,7 @@ class RouterTest extends MediaWikiUnitTestCase { $router = $this->createRouter( $requestWithoutBody ); $responseWithoutBody = $router->execute( $requestWithoutBody ); $this->assertSame( 200, $responseWithoutBody->getStatusCode() ); - } + } public function testDeleteRequestWithBody() { // Test DELETE request with body diff --git a/tests/phpunit/unit/includes/libs/ParamValidator/TypeDef/EnumDefTest.php b/tests/phpunit/unit/includes/libs/ParamValidator/TypeDef/EnumDefTest.php index eb67e1647a84..1b46e561d083 100644 --- a/tests/phpunit/unit/includes/libs/ParamValidator/TypeDef/EnumDefTest.php +++ b/tests/phpunit/unit/includes/libs/ParamValidator/TypeDef/EnumDefTest.php @@ -35,12 +35,14 @@ class EnumDefTest extends TypeDefTestCase { ] ], 'Deprecated with message' => [ 'b', 'b', $settings, [], [ - [ 'code' => 'deprecated-value', 'data' => null ] - ] ], + [ 'code' => 'deprecated-value', 'data' => null ] + ] + ], 'Deprecated with data message' => [ 'e', 'e', $settings, [], [ - [ 'code' => 'deprecated-value', 'data' => [ 'x' => 'y' ] ] - ] ], + [ 'code' => 'deprecated-value', 'data' => [ 'x' => 'y' ] ] + ] + ], 'Deprecated, from default' => [ 'c', 'c', $settings, [ 'is-default' => true ], [] ], -- cgit v1.2.3