From 83fb19cb13f3485cfde25f550b8fc81fb9c61b95 Mon Sep 17 00:00:00 2001 From: Reedy Date: Sat, 19 Mar 2016 01:05:19 +0000 Subject: [PATCH] Swap the rest of array() -> [] Change-Id: I76a7259ed952a0673a1941f08b39b545211fba07 --- maintenance/language/digit2html.php | 4 +- tests/phpunit/includes/LinkerTest.php | 132 ++++----- tests/phpunit/includes/OutputPageTest.php | 52 ++-- tests/phpunit/includes/PathRouterTest.php | 9 +- .../includes/api/format/ApiFormatPhpTest.php | 120 ++++---- .../includes/api/format/ApiFormatXmlTest.php | 132 ++++----- .../content/CssContentHandlerTest.php | 19 +- .../content/JavaScriptContentHandlerTest.php | 19 +- .../content/JavaScriptContentTest.php | 33 ++- tests/phpunit/includes/import/ImportTest.php | 32 +-- tests/phpunit/includes/libs/CSSMinTest.php | 144 +++++----- tests/phpunit/includes/media/GIFTest.php | 15 +- tests/phpunit/includes/media/PNGTest.php | 15 +- tests/phpunit/includes/media/WebPTest.php | 80 +++--- .../includes/parser/PreprocessorTest.php | 258 +++++++++--------- .../includes/password/BcryptPasswordTest.php | 40 +-- .../LayeredParameterizedPasswordTest.php | 10 +- .../includes/upload/UploadBaseTest.php | 164 +++++------ .../includes/utils/MWCryptHKDFTest.php | 29 +- tests/phpunit/languages/LanguageTest.php | 22 +- 20 files changed, 697 insertions(+), 632 deletions(-) diff --git a/maintenance/language/digit2html.php b/maintenance/language/digit2html.php index eddfa261ae..46616db56b 100644 --- a/maintenance/language/digit2html.php +++ b/maintenance/language/digit2html.php @@ -32,12 +32,12 @@ class Digit2Html extends Maintenance { # A list of unicode numerals is available at: # http://www.fileformat.info/info/unicode/category/Nd/list.htm - private $mLangs = array( + private $mLangs = [ 'Ar', 'As', 'Bh', 'Bo', 'Dz', 'Fa', 'Gu', 'Hi', 'Km', 'Kn', 'Ks', 'Lo', 'Ml', 'Mr', 'Ne', 'New', 'Or', 'Pa', 'Pi', 'Sa' - ); + ]; public function __construct() { parent::__construct(); diff --git a/tests/phpunit/includes/LinkerTest.php b/tests/phpunit/includes/LinkerTest.php index 82482576ef..e50b4f1490 100644 --- a/tests/phpunit/includes/LinkerTest.php +++ b/tests/phpunit/includes/LinkerTest.php @@ -132,129 +132,129 @@ class LinkerTest extends MediaWikiLangTestCase { $wikiId = 'enwiki'; // $wgConf has a fake entry for this // @codingStandardsIgnoreStart Generic.Files.LineLength - return array( + return [ // Linker::formatComment - array( + [ 'a<script>b', 'a */" - ), - array( + ], + [ '→‎autocomment', "/* autocomment */", false, true - ), - array( + ], + [ '‎autocomment', "/* autocomment */", null - ), - array( + ], + [ '→‎autocomment', "/* autocomment */", false, false - ), - array( + ], + [ '→‎autocomment', "/* autocomment */", false, false, $wikiId - ), + ], // Linker::formatLinksInComment - array( + [ 'abc link def', "abc [[link]] def", - ), - array( + ], + [ 'abc text def', "abc [[link|text]] def", - ), - array( + ], + [ 'abc Special:BlankPage def', "abc [[Special:BlankPage|]] def", - ), - array( + ], + [ 'abc ąśż def', "abc [[%C4%85%C5%9B%C5%BC]] def", - ), - array( + ], + [ 'abc #section def', "abc [[#section]] def", - ), - array( + ], + [ 'abc /subpage def', "abc [[/subpage]] def", - ), - array( + ], + [ 'abc "evil!" def', "abc [[\"evil!\"]] def", - ), - array( + ], + [ 'abc [[<script>very evil</script>]] def', "abc [[]] def", - ), - array( + ], + [ 'abc [[|]] def', "abc [[|]] def", - ), - array( + ], + [ 'abc link def', "abc [[link]] def", false, false - ), - array( + ], + [ 'abc link def', "abc [[link]] def", false, false, $wikiId - ) - ); + ], + ]; // @codingStandardsIgnoreEnd } @@ -290,23 +290,23 @@ class LinkerTest extends MediaWikiLangTestCase { public static function provideCasesForFormatLinksInComment() { // @codingStandardsIgnoreStart Generic.Files.LineLength - return array( - array( + return [ + [ 'foo bar Special:BlankPage', 'foo bar [[Special:BlankPage]]', null, - ), - array( + ], + [ 'Foo\'bar', "[[Foo'bar]]", 'enwiki', - ), - array( + ], + [ 'foo bar Special:BlankPage', 'foo bar [[Special:BlankPage]]', 'enwiki', - ), - ); + ], + ]; // @codingStandardsIgnoreEnd } } diff --git a/tests/phpunit/includes/OutputPageTest.php b/tests/phpunit/includes/OutputPageTest.php index 9bef0384d4..2f63ca83b7 100644 --- a/tests/phpunit/includes/OutputPageTest.php +++ b/tests/phpunit/includes/OutputPageTest.php @@ -138,62 +138,62 @@ class OutputPageTest extends MediaWikiTestCase { public static function provideMakeResourceLoaderLink() { // @codingStandardsIgnoreStart Generic.Files.LineLength - return array( + return [ // Load module script only - array( - array( 'test.foo', ResourceLoaderModule::TYPE_SCRIPTS ), + [ + [ 'test.foo', ResourceLoaderModule::TYPE_SCRIPTS ], "" - ), - array( + ], + [ // Don't condition wrap raw modules (like the startup module) - array( 'test.raw', ResourceLoaderModule::TYPE_SCRIPTS ), + [ 'test.raw', ResourceLoaderModule::TYPE_SCRIPTS ], '' - ), + ], // Load module styles only // This also tests the order the modules are put into the url - array( - array( array( 'test.baz', 'test.foo', 'test.bar' ), ResourceLoaderModule::TYPE_STYLES ), + [ + [ [ 'test.baz', 'test.foo', 'test.bar' ], ResourceLoaderModule::TYPE_STYLES ], '' - ), + ], // Load private module (only=scripts) - array( - array( 'test.quux', ResourceLoaderModule::TYPE_SCRIPTS ), + [ + [ 'test.quux', ResourceLoaderModule::TYPE_SCRIPTS ], "" - ), + ], // Load private module (combined) - array( - array( 'test.quux', ResourceLoaderModule::TYPE_COMBINED ), + [ + [ 'test.quux', ResourceLoaderModule::TYPE_COMBINED ], "" - ), + ], // Load no modules - array( - array( array(), ResourceLoaderModule::TYPE_COMBINED ), + [ + [ [], ResourceLoaderModule::TYPE_COMBINED ], '', - ), + ], // noscript group - array( - array( 'test.noscript', ResourceLoaderModule::TYPE_STYLES ), + [ + [ 'test.noscript', ResourceLoaderModule::TYPE_STYLES ], '' - ), + ], // Load two modules in separate groups - array( - array( array( 'test.group.foo', 'test.group.bar' ), ResourceLoaderModule::TYPE_COMBINED ), + [ + [ [ 'test.group.foo', 'test.group.bar' ], ResourceLoaderModule::TYPE_COMBINED ], "\n" . "" - ), - ); + ], + ]; // @codingStandardsIgnoreEnd } diff --git a/tests/phpunit/includes/PathRouterTest.php b/tests/phpunit/includes/PathRouterTest.php index d5f5420e2b..67364cb301 100644 --- a/tests/phpunit/includes/PathRouterTest.php +++ b/tests/phpunit/includes/PathRouterTest.php @@ -237,8 +237,13 @@ class PathRouterTest extends MediaWikiTestCase { */ public function testLength() { // @codingStandardsIgnoreStart Ignore long line warnings - $matches = $this->basicRouter->parse( "/wiki/Lorem_ipsum_dolor_sit_amet,_consectetur_adipisicing_elit,_sed_do_eiusmod_tempor_incididunt_ut_labore_et_dolore_magna_aliqua._Ut_enim_ad_minim_veniam,_quis_nostrud_exercitation_ullamco_laboris_nisi_ut_aliquip_ex_ea_commodo_consequat._Duis_aute_irure_dolor_in_reprehenderit_in_voluptate_velit_esse_cillum_dolore_eu_fugiat_nulla_pariatur._Excepteur_sint_occaecat_cupidatat_non_proident,_sunt_in_culpa_qui_officia_deserunt_mollit_anim_id_est_laborum." ); - $this->assertEquals( $matches, array( 'title' => "Lorem_ipsum_dolor_sit_amet,_consectetur_adipisicing_elit,_sed_do_eiusmod_tempor_incididunt_ut_labore_et_dolore_magna_aliqua._Ut_enim_ad_minim_veniam,_quis_nostrud_exercitation_ullamco_laboris_nisi_ut_aliquip_ex_ea_commodo_consequat._Duis_aute_irure_dolor_in_reprehenderit_in_voluptate_velit_esse_cillum_dolore_eu_fugiat_nulla_pariatur._Excepteur_sint_occaecat_cupidatat_non_proident,_sunt_in_culpa_qui_officia_deserunt_mollit_anim_id_est_laborum." ) ); + $matches = $this->basicRouter->parse( + "/wiki/Lorem_ipsum_dolor_sit_amet,_consectetur_adipisicing_elit,_sed_do_eiusmod_tempor_incididunt_ut_labore_et_dolore_magna_aliqua._Ut_enim_ad_minim_veniam,_quis_nostrud_exercitation_ullamco_laboris_nisi_ut_aliquip_ex_ea_commodo_consequat._Duis_aute_irure_dolor_in_reprehenderit_in_voluptate_velit_esse_cillum_dolore_eu_fugiat_nulla_pariatur._Excepteur_sint_occaecat_cupidatat_non_proident,_sunt_in_culpa_qui_officia_deserunt_mollit_anim_id_est_laborum." + ); + $this->assertEquals( + $matches, + [ 'title' => "Lorem_ipsum_dolor_sit_amet,_consectetur_adipisicing_elit,_sed_do_eiusmod_tempor_incididunt_ut_labore_et_dolore_magna_aliqua._Ut_enim_ad_minim_veniam,_quis_nostrud_exercitation_ullamco_laboris_nisi_ut_aliquip_ex_ea_commodo_consequat._Duis_aute_irure_dolor_in_reprehenderit_in_voluptate_velit_esse_cillum_dolore_eu_fugiat_nulla_pariatur._Excepteur_sint_occaecat_cupidatat_non_proident,_sunt_in_culpa_qui_officia_deserunt_mollit_anim_id_est_laborum." ] + ); // @codingStandardsIgnoreEnd } diff --git a/tests/phpunit/includes/api/format/ApiFormatPhpTest.php b/tests/phpunit/includes/api/format/ApiFormatPhpTest.php index 690ba3ae74..0028bbb0ac 100644 --- a/tests/phpunit/includes/api/format/ApiFormatPhpTest.php +++ b/tests/phpunit/includes/api/format/ApiFormatPhpTest.php @@ -22,80 +22,80 @@ class ApiFormatPhpTest extends ApiFormatTestBase { public static function provideGeneralEncoding() { // @codingStandardsIgnoreStart Generic.Files.LineLength return array_merge( - self::addFormatVersion( 1, array( + self::addFormatVersion( 1, [ // Basic types - array( array( null ), 'a:1:{i:0;N;}' ), - array( array( true ), 'a:1:{i:0;s:0:"";}' ), - array( array( false ), 'a:0:{}' ), - array( array( true, ApiResult::META_BC_BOOLS => array( 0 ) ), - 'a:1:{i:0;b:1;}' ), - array( array( false, ApiResult::META_BC_BOOLS => array( 0 ) ), - 'a:1:{i:0;b:0;}' ), - array( array( 42 ), 'a:1:{i:0;i:42;}' ), - array( array( 42.5 ), 'a:1:{i:0;d:42.5;}' ), - array( array( 1e42 ), 'a:1:{i:0;d:1.0E+42;}' ), - array( array( 'foo' ), 'a:1:{i:0;s:3:"foo";}' ), - array( array( 'fóo' ), 'a:1:{i:0;s:4:"fóo";}' ), + [ [ null ], 'a:1:{i:0;N;}' ], + [ [ true ], 'a:1:{i:0;s:0:"";}' ], + [ [ false ], 'a:0:{}' ], + [ [ true, ApiResult::META_BC_BOOLS => [ 0 ] ], + 'a:1:{i:0;b:1;}' ], + [ [ false, ApiResult::META_BC_BOOLS => [ 0 ] ], + 'a:1:{i:0;b:0;}' ], + [ [ 42 ], 'a:1:{i:0;i:42;}' ], + [ [ 42.5 ], 'a:1:{i:0;d:42.5;}' ], + [ [ 1e42 ], 'a:1:{i:0;d:1.0E+42;}' ], + [ [ 'foo' ], 'a:1:{i:0;s:3:"foo";}' ], + [ [ 'fóo' ], 'a:1:{i:0;s:4:"fóo";}' ], // Arrays and objects - array( array( array() ), 'a:1:{i:0;a:0:{}}' ), - array( array( array( 1 ) ), 'a:1:{i:0;a:1:{i:0;i:1;}}' ), - array( array( array( 'x' => 1 ) ), 'a:1:{i:0;a:1:{s:1:"x";i:1;}}' ), - array( array( array( 2 => 1 ) ), 'a:1:{i:0;a:1:{i:2;i:1;}}' ), - array( array( (object)array() ), 'a:1:{i:0;a:0:{}}' ), - array( array( array( 1, ApiResult::META_TYPE => 'assoc' ) ), 'a:1:{i:0;a:1:{i:0;i:1;}}' ), - array( array( array( 'x' => 1, ApiResult::META_TYPE => 'array' ) ), 'a:1:{i:0;a:1:{i:0;i:1;}}' ), - array( array( array( 'x' => 1, ApiResult::META_TYPE => 'kvp' ) ), 'a:1:{i:0;a:1:{s:1:"x";i:1;}}' ), - array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCkvp', ApiResult::META_KVP_KEY_NAME => 'key' ) ), - 'a:1:{i:0;a:1:{i:0;a:2:{s:3:"key";s:1:"x";s:1:"*";i:1;}}}' ), - array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCarray' ) ), 'a:1:{i:0;a:1:{s:1:"x";i:1;}}' ), - array( array( array( 'a', 'b', ApiResult::META_TYPE => 'BCassoc' ) ), 'a:1:{i:0;a:2:{i:0;s:1:"a";i:1;s:1:"b";}}' ), + [ [ [] ], 'a:1:{i:0;a:0:{}}' ], + [ [ [ 1 ] ], 'a:1:{i:0;a:1:{i:0;i:1;}}' ], + [ [ [ 'x' => 1 ] ], 'a:1:{i:0;a:1:{s:1:"x";i:1;}}' ], + [ [ [ 2 => 1 ] ], 'a:1:{i:0;a:1:{i:2;i:1;}}' ], + [ [ (object)[] ], 'a:1:{i:0;a:0:{}}' ], + [ [ [ 1, ApiResult::META_TYPE => 'assoc' ] ], 'a:1:{i:0;a:1:{i:0;i:1;}}' ], + [ [ [ 'x' => 1, ApiResult::META_TYPE => 'array' ] ], 'a:1:{i:0;a:1:{i:0;i:1;}}' ], + [ [ [ 'x' => 1, ApiResult::META_TYPE => 'kvp' ] ], 'a:1:{i:0;a:1:{s:1:"x";i:1;}}' ], + [ [ [ 'x' => 1, ApiResult::META_TYPE => 'BCkvp', ApiResult::META_KVP_KEY_NAME => 'key' ] ], + 'a:1:{i:0;a:1:{i:0;a:2:{s:3:"key";s:1:"x";s:1:"*";i:1;}}}' ], + [ [ [ 'x' => 1, ApiResult::META_TYPE => 'BCarray' ] ], 'a:1:{i:0;a:1:{s:1:"x";i:1;}}' ], + [ [ [ 'a', 'b', ApiResult::META_TYPE => 'BCassoc' ] ], 'a:1:{i:0;a:2:{i:0;s:1:"a";i:1;s:1:"b";}}' ], // Content - array( array( 'content' => 'foo', ApiResult::META_CONTENT => 'content' ), - 'a:1:{s:1:"*";s:3:"foo";}' ), + [ [ 'content' => 'foo', ApiResult::META_CONTENT => 'content' ], + 'a:1:{s:1:"*";s:3:"foo";}' ], // BC Subelements - array( array( 'foo' => 'foo', ApiResult::META_BC_SUBELEMENTS => array( 'foo' ) ), - 'a:1:{s:3:"foo";a:1:{s:1:"*";s:3:"foo";}}' ), - ) ), - self::addFormatVersion( 2, array( + [ [ 'foo' => 'foo', ApiResult::META_BC_SUBELEMENTS => [ 'foo' ] ], + 'a:1:{s:3:"foo";a:1:{s:1:"*";s:3:"foo";}}' ], + ] ), + self::addFormatVersion( 2, [ // Basic types - array( array( null ), 'a:1:{i:0;N;}' ), - array( array( true ), 'a:1:{i:0;b:1;}' ), - array( array( false ), 'a:1:{i:0;b:0;}' ), - array( array( true, ApiResult::META_BC_BOOLS => array( 0 ) ), - 'a:1:{i:0;b:1;}' ), - array( array( false, ApiResult::META_BC_BOOLS => array( 0 ) ), - 'a:1:{i:0;b:0;}' ), - array( array( 42 ), 'a:1:{i:0;i:42;}' ), - array( array( 42.5 ), 'a:1:{i:0;d:42.5;}' ), - array( array( 1e42 ), 'a:1:{i:0;d:1.0E+42;}' ), - array( array( 'foo' ), 'a:1:{i:0;s:3:"foo";}' ), - array( array( 'fóo' ), 'a:1:{i:0;s:4:"fóo";}' ), + [ [ null ], 'a:1:{i:0;N;}' ], + [ [ true ], 'a:1:{i:0;b:1;}' ], + [ [ false ], 'a:1:{i:0;b:0;}' ], + [ [ true, ApiResult::META_BC_BOOLS => [ 0 ] ], + 'a:1:{i:0;b:1;}' ], + [ [ false, ApiResult::META_BC_BOOLS => [ 0 ] ], + 'a:1:{i:0;b:0;}' ], + [ [ 42 ], 'a:1:{i:0;i:42;}' ], + [ [ 42.5 ], 'a:1:{i:0;d:42.5;}' ], + [ [ 1e42 ], 'a:1:{i:0;d:1.0E+42;}' ], + [ [ 'foo' ], 'a:1:{i:0;s:3:"foo";}' ], + [ [ 'fóo' ], 'a:1:{i:0;s:4:"fóo";}' ], // Arrays and objects - array( array( array() ), 'a:1:{i:0;a:0:{}}' ), - array( array( array( 1 ) ), 'a:1:{i:0;a:1:{i:0;i:1;}}' ), - array( array( array( 'x' => 1 ) ), 'a:1:{i:0;a:1:{s:1:"x";i:1;}}' ), - array( array( array( 2 => 1 ) ), 'a:1:{i:0;a:1:{i:2;i:1;}}' ), - array( array( (object)array() ), 'a:1:{i:0;a:0:{}}' ), - array( array( array( 1, ApiResult::META_TYPE => 'assoc' ) ), 'a:1:{i:0;a:1:{i:0;i:1;}}' ), - array( array( array( 'x' => 1, ApiResult::META_TYPE => 'array' ) ), 'a:1:{i:0;a:1:{i:0;i:1;}}' ), - array( array( array( 'x' => 1, ApiResult::META_TYPE => 'kvp' ) ), 'a:1:{i:0;a:1:{s:1:"x";i:1;}}' ), - array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCkvp', ApiResult::META_KVP_KEY_NAME => 'key' ) ), - 'a:1:{i:0;a:1:{s:1:"x";i:1;}}' ), - array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCarray' ) ), 'a:1:{i:0;a:1:{i:0;i:1;}}' ), - array( array( array( 'a', 'b', ApiResult::META_TYPE => 'BCassoc' ) ), 'a:1:{i:0;a:2:{i:0;s:1:"a";i:1;s:1:"b";}}' ), + [ [ [] ], 'a:1:{i:0;a:0:{}}' ], + [ [ [ 1 ] ], 'a:1:{i:0;a:1:{i:0;i:1;}}' ], + [ [ [ 'x' => 1 ] ], 'a:1:{i:0;a:1:{s:1:"x";i:1;}}' ], + [ [ [ 2 => 1 ] ], 'a:1:{i:0;a:1:{i:2;i:1;}}' ], + [ [ (object)[] ], 'a:1:{i:0;a:0:{}}' ], + [ [ [ 1, ApiResult::META_TYPE => 'assoc' ] ], 'a:1:{i:0;a:1:{i:0;i:1;}}' ], + [ [ [ 'x' => 1, ApiResult::META_TYPE => 'array' ] ], 'a:1:{i:0;a:1:{i:0;i:1;}}' ], + [ [ [ 'x' => 1, ApiResult::META_TYPE => 'kvp' ] ], 'a:1:{i:0;a:1:{s:1:"x";i:1;}}' ], + [ [ [ 'x' => 1, ApiResult::META_TYPE => 'BCkvp', ApiResult::META_KVP_KEY_NAME => 'key' ] ], + 'a:1:{i:0;a:1:{s:1:"x";i:1;}}' ], + [ [ [ 'x' => 1, ApiResult::META_TYPE => 'BCarray' ] ], 'a:1:{i:0;a:1:{i:0;i:1;}}' ], + [ [ [ 'a', 'b', ApiResult::META_TYPE => 'BCassoc' ] ], 'a:1:{i:0;a:2:{i:0;s:1:"a";i:1;s:1:"b";}}' ], // Content - array( array( 'content' => 'foo', ApiResult::META_CONTENT => 'content' ), - 'a:1:{s:7:"content";s:3:"foo";}' ), + [ [ 'content' => 'foo', ApiResult::META_CONTENT => 'content' ], + 'a:1:{s:7:"content";s:3:"foo";}' ], // BC Subelements - array( array( 'foo' => 'foo', ApiResult::META_BC_SUBELEMENTS => array( 'foo' ) ), - 'a:1:{s:3:"foo";s:3:"foo";}' ), - ) ) + [ [ 'foo' => 'foo', ApiResult::META_BC_SUBELEMENTS => [ 'foo' ] ], + 'a:1:{s:3:"foo";s:3:"foo";}' ], + ] ) ); // @codingStandardsIgnoreEnd } diff --git a/tests/phpunit/includes/api/format/ApiFormatXmlTest.php b/tests/phpunit/includes/api/format/ApiFormatXmlTest.php index 0b7ae35a5d..3fef0b0027 100644 --- a/tests/phpunit/includes/api/format/ApiFormatXmlTest.php +++ b/tests/phpunit/includes/api/format/ApiFormatXmlTest.php @@ -25,98 +25,98 @@ class ApiFormatXmlTest extends ApiFormatTestBase { public static function provideGeneralEncoding() { // @codingStandardsIgnoreStart Generic.Files.LineLength - return array( + return [ // Basic types - array( array( null, 'a' => null ), '<_v _idx="0" />' ), - array( array( true, 'a' => true ), '<_v _idx="0">true' ), - array( array( false, 'a' => false ), '<_v _idx="0">false' ), - array( array( true, 'a' => true, ApiResult::META_BC_BOOLS => array( 0, 'a' ) ), - '<_v _idx="0">1' ), - array( array( false, 'a' => false, ApiResult::META_BC_BOOLS => array( 0, 'a' ) ), - '<_v _idx="0">' ), - array( array( 42, 'a' => 42 ), '<_v _idx="0">42' ), - array( array( 42.5, 'a' => 42.5 ), '<_v _idx="0">42.5' ), - array( array( 1e42, 'a' => 1e42 ), '<_v _idx="0">1.0E+42' ), - array( array( 'foo', 'a' => 'foo' ), '<_v _idx="0">foo' ), - array( array( 'fóo', 'a' => 'fóo' ), '<_v _idx="0">fóo' ), + [ [ null, 'a' => null ], '<_v _idx="0" />' ], + [ [ true, 'a' => true ], '<_v _idx="0">true' ], + [ [ false, 'a' => false ], '<_v _idx="0">false' ], + [ [ true, 'a' => true, ApiResult::META_BC_BOOLS => [ 0, 'a' ] ], + '<_v _idx="0">1' ], + [ [ false, 'a' => false, ApiResult::META_BC_BOOLS => [ 0, 'a' ] ], + '<_v _idx="0">' ], + [ [ 42, 'a' => 42 ], '<_v _idx="0">42' ], + [ [ 42.5, 'a' => 42.5 ], '<_v _idx="0">42.5' ], + [ [ 1e42, 'a' => 1e42 ], '<_v _idx="0">1.0E+42' ], + [ [ 'foo', 'a' => 'foo' ], '<_v _idx="0">foo' ], + [ [ 'fóo', 'a' => 'fóo' ], '<_v _idx="0">fóo' ], // Arrays and objects - array( array( array() ), '<_v />' ), - array( array( array( 'x' => 1 ) ), '<_v x="1" />' ), - array( array( array( 2 => 1 ) ), '<_v><_v _idx="2">1' ), - array( array( (object)array() ), '<_v />' ), - array( array( array( 1, ApiResult::META_TYPE => 'assoc' ) ), '<_v><_v _idx="0">1' ), - array( array( array( 'x' => 1, ApiResult::META_TYPE => 'array' ) ), '<_v><_v>1' ), - array( array( array( 'x' => 1, 'y' => array( 'z' => 1 ), ApiResult::META_TYPE => 'kvp' ) ), - '<_v><_v _name="x" xml:space="preserve">1<_v _name="y">1' ), - array( array( array( 'x' => 1, ApiResult::META_TYPE => 'kvp', ApiResult::META_INDEXED_TAG_NAME => 'i', ApiResult::META_KVP_KEY_NAME => 'key' ) ), - '<_v>1' ), - array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCkvp', ApiResult::META_KVP_KEY_NAME => 'key' ) ), - '<_v><_v key="x" xml:space="preserve">1' ), - array( array( array( 'x' => 1, ApiResult::META_TYPE => 'BCarray' ) ), '<_v x="1" />' ), - array( array( array( 'a', 'b', ApiResult::META_TYPE => 'BCassoc' ) ), '<_v><_v _idx="0">a<_v _idx="1">b' ), + [ [ [] ], '<_v />' ], + [ [ [ 'x' => 1 ] ], '<_v x="1" />' ], + [ [ [ 2 => 1 ] ], '<_v><_v _idx="2">1' ], + [ [ (object)[] ], '<_v />' ], + [ [ [ 1, ApiResult::META_TYPE => 'assoc' ] ], '<_v><_v _idx="0">1' ], + [ [ [ 'x' => 1, ApiResult::META_TYPE => 'array' ] ], '<_v><_v>1' ], + [ [ [ 'x' => 1, 'y' => [ 'z' => 1 ], ApiResult::META_TYPE => 'kvp' ] ], + '<_v><_v _name="x" xml:space="preserve">1<_v _name="y">1' ], + [ [ [ 'x' => 1, ApiResult::META_TYPE => 'kvp', ApiResult::META_INDEXED_TAG_NAME => 'i', ApiResult::META_KVP_KEY_NAME => 'key' ] ], + '<_v>1' ], + [ [ [ 'x' => 1, ApiResult::META_TYPE => 'BCkvp', ApiResult::META_KVP_KEY_NAME => 'key' ] ], + '<_v><_v key="x" xml:space="preserve">1' ], + [ [ [ 'x' => 1, ApiResult::META_TYPE => 'BCarray' ] ], '<_v x="1" />' ], + [ [ [ 'a', 'b', ApiResult::META_TYPE => 'BCassoc' ] ], '<_v><_v _idx="0">a<_v _idx="1">b' ], // Content - array( array( 'content' => 'foo', ApiResult::META_CONTENT => 'content' ), - 'foo' ), + [ [ 'content' => 'foo', ApiResult::META_CONTENT => 'content' ], + 'foo' ], // Specified element name - array( array( 'foo', 'bar', ApiResult::META_INDEXED_TAG_NAME => 'itn' ), - 'foobar' ), + [ [ 'foo', 'bar', ApiResult::META_INDEXED_TAG_NAME => 'itn' ], + 'foobar' ], // Subelements - array( array( 'a' => 1, 's' => 1, '_subelements' => array( 's' ) ), - '1' ), + [ [ 'a' => 1, 's' => 1, '_subelements' => [ 's' ] ], + '1' ], // Content and subelement - array( array( 'a' => 1, 'content' => 'foo', ApiResult::META_CONTENT => 'content' ), - 'foo' ), - array( array( 's' => array(), 'content' => 'foo', ApiResult::META_CONTENT => 'content' ), - 'foo' ), - array( - array( + [ [ 'a' => 1, 'content' => 'foo', ApiResult::META_CONTENT => 'content' ], + 'foo' ], + [ [ 's' => [], 'content' => 'foo', ApiResult::META_CONTENT => 'content' ], + 'foo' ], + [ + [ 's' => 1, 'content' => 'foo', ApiResult::META_CONTENT => 'content', - ApiResult::META_SUBELEMENTS => array( 's' ) - ), + ApiResult::META_SUBELEMENTS => [ 's' ] + ], '1foo' - ), + ], // BC Subelements - array( array( 'foo' => 'foo', ApiResult::META_BC_SUBELEMENTS => array( 'foo' ) ), - 'foo' ), + [ [ 'foo' => 'foo', ApiResult::META_BC_SUBELEMENTS => [ 'foo' ] ], + 'foo' ], // Name mangling - array( array( 'foo.bar' => 1 ), '' ), - array( array( '' => 1 ), '' ), - array( array( 'foo bar' => 1 ), '' ), - array( array( 'foo:bar' => 1 ), '' ), - array( array( 'foo%.bar' => 1 ), '' ), - array( array( '4foo' => 1, 'foo4' => 1 ), '' ), - array( array( "foo\xe3\x80\x80bar" => 1 ), '' ), - array( array( 'foo:bar' => 1, ApiResult::META_PRESERVE_KEYS => array( 'foo:bar' ) ), - '' ), - array( array( 'a', 'b', ApiResult::META_INDEXED_TAG_NAME => 'foo bar' ), - '<_foo.20.bar>a<_foo.20.bar>b' ), + [ [ 'foo.bar' => 1 ], '' ], + [ [ '' => 1 ], '' ], + [ [ 'foo bar' => 1 ], '' ], + [ [ 'foo:bar' => 1 ], '' ], + [ [ 'foo%.bar' => 1 ], '' ], + [ [ '4foo' => 1, 'foo4' => 1 ], '' ], + [ [ "foo\xe3\x80\x80bar" => 1 ], '' ], + [ [ 'foo:bar' => 1, ApiResult::META_PRESERVE_KEYS => [ 'foo:bar' ] ], + '' ], + [ [ 'a', 'b', ApiResult::META_INDEXED_TAG_NAME => 'foo bar' ], + '<_foo.20.bar>a<_foo.20.bar>b' ], // includenamespace param - array( array( 'x' => 'foo' ), '', - array( 'includexmlnamespace' => 1 ) ), + [ [ 'x' => 'foo' ], '', + [ 'includexmlnamespace' => 1 ] ], // xslt param - array( array(), 'Invalid or non-existent stylesheet specified', - array( 'xslt' => 'DoesNotExist' ) ), - array( array(), 'Stylesheet should be in the MediaWiki namespace.', - array( 'xslt' => 'ApiFormatXmlTest' ) ), - array( array(), 'Stylesheet should have .xsl extension.', - array( 'xslt' => 'MediaWiki:ApiFormatXmlTest' ) ), - array( array(), + [ [], 'Invalid or non-existent stylesheet specified', + [ 'xslt' => 'DoesNotExist' ] ], + [ [], 'Stylesheet should be in the MediaWiki namespace.', + [ 'xslt' => 'ApiFormatXmlTest' ] ], + [ [], 'Stylesheet should have .xsl extension.', + [ 'xslt' => 'MediaWiki:ApiFormatXmlTest' ] ], + [ [], 'getLocalURL( 'action=raw' ) ) . '" type="text/xsl" ?>', - array( 'xslt' => 'MediaWiki:ApiFormatXmlTest.xsl' ) ), - ); + [ 'xslt' => 'MediaWiki:ApiFormatXmlTest.xsl' ] ], + ]; // @codingStandardsIgnoreEnd } diff --git a/tests/phpunit/includes/content/CssContentHandlerTest.php b/tests/phpunit/includes/content/CssContentHandlerTest.php index 9643d13b84..d92fb8fc15 100644 --- a/tests/phpunit/includes/content/CssContentHandlerTest.php +++ b/tests/phpunit/includes/content/CssContentHandlerTest.php @@ -22,11 +22,20 @@ class CssContentHandlerTest extends MediaWikiLangTestCase { */ 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);" ), - ); + return [ + [ + 'MediaWiki:MonoBook.css', + "/* #REDIRECT */@import url(//example.org/w/index.php?title=MediaWiki:MonoBook.css&action=raw&ctype=text/css);" + ], + [ + 'User:FooBar/common.css', + "/* #REDIRECT */@import url(//example.org/w/index.php?title=User:FooBar/common.css&action=raw&ctype=text/css);" + ], + [ + '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/content/JavaScriptContentHandlerTest.php b/tests/phpunit/includes/content/JavaScriptContentHandlerTest.php index 17f653c454..d229623980 100644 --- a/tests/phpunit/includes/content/JavaScriptContentHandlerTest.php +++ b/tests/phpunit/includes/content/JavaScriptContentHandlerTest.php @@ -22,11 +22,20 @@ class JavaScriptContentHandlerTest extends MediaWikiLangTestCase { */ public static function provideMakeRedirectContent() { // @codingStandardsIgnoreStart Generic.Files.LineLength - return array( - array( 'MediaWiki:MonoBook.js', '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=MediaWiki:MonoBook.js\u0026action=raw\u0026ctype=text/javascript");' ), - array( 'User:FooBar/common.js', '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=User:FooBar/common.js\u0026action=raw\u0026ctype=text/javascript");' ), - array( 'Gadget:FooBaz.js', '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=Gadget:FooBaz.js\u0026action=raw\u0026ctype=text/javascript");' ), - ); + return [ + [ + 'MediaWiki:MonoBook.js', + '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=MediaWiki:MonoBook.js\u0026action=raw\u0026ctype=text/javascript");' + ], + [ + 'User:FooBar/common.js', + '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=User:FooBar/common.js\u0026action=raw\u0026ctype=text/javascript");' + ], + [ + 'Gadget:FooBaz.js', + '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=Gadget:FooBaz.js\u0026action=raw\u0026ctype=text/javascript");' + ], + ]; // @codingStandardsIgnoreEnd } } diff --git a/tests/phpunit/includes/content/JavaScriptContentTest.php b/tests/phpunit/includes/content/JavaScriptContentTest.php index abe352a12f..8cbbfb8a78 100644 --- a/tests/phpunit/includes/content/JavaScriptContentTest.php +++ b/tests/phpunit/includes/content/JavaScriptContentTest.php @@ -278,10 +278,10 @@ class JavaScriptContentTest extends TextContentTest { ], // @codingStandardsIgnoreStart Generic.Files.LineLength - array( + [ '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=MediaWiki:MonoBook.js\u0026action=raw\u0026ctype=text/javascript");', '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=TestUpdateRedirect_target\u0026action=raw\u0026ctype=text/javascript");' - ) + ] // @codingStandardsIgnoreEnd ]; } @@ -333,15 +333,30 @@ class JavaScriptContentTest extends TextContentTest { */ public static function provideGetRedirectTarget() { // @codingStandardsIgnoreStart Generic.Files.LineLength - return array( - array( 'MediaWiki:MonoBook.js', '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=MediaWiki:MonoBook.js\u0026action=raw\u0026ctype=text/javascript");' ), - array( 'User:FooBar/common.js', '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=User:FooBar/common.js\u0026action=raw\u0026ctype=text/javascript");' ), - array( 'Gadget:FooBaz.js', '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=Gadget:FooBaz.js\u0026action=raw\u0026ctype=text/javascript");' ), + return [ + [ + 'MediaWiki:MonoBook.js', + '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=MediaWiki:MonoBook.js\u0026action=raw\u0026ctype=text/javascript");' + ], + [ + 'User:FooBar/common.js', + '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=User:FooBar/common.js\u0026action=raw\u0026ctype=text/javascript");' + ], + [ + 'Gadget:FooBaz.js', + '/* #REDIRECT */mw.loader.load("//example.org/w/index.php?title=Gadget:FooBaz.js\u0026action=raw\u0026ctype=text/javascript");' + ], // No #REDIRECT comment - array( null, 'mw.loader.load("//example.org/w/index.php?title=MediaWiki:NoRedirect.js\u0026action=raw\u0026ctype=text/javascript");' ), + [ + null, + 'mw.loader.load("//example.org/w/index.php?title=MediaWiki:NoRedirect.js\u0026action=raw\u0026ctype=text/javascript");' + ], // Different domain - array( null, '/* #REDIRECT */mw.loader.load("//example.com/w/index.php?title=MediaWiki:OtherWiki.js\u0026action=raw\u0026ctype=text/javascript");' ), - ); + [ + null, + '/* #REDIRECT */mw.loader.load("//example.com/w/index.php?title=MediaWiki:OtherWiki.js\u0026action=raw\u0026ctype=text/javascript");' + ], + ]; // @codingStandardsIgnoreEnd } } diff --git a/tests/phpunit/includes/import/ImportTest.php b/tests/phpunit/includes/import/ImportTest.php index f4aac235a2..9d05d15256 100644 --- a/tests/phpunit/includes/import/ImportTest.php +++ b/tests/phpunit/includes/import/ImportTest.php @@ -37,8 +37,8 @@ class ImportTest extends MediaWikiLangTestCase { public function getUnknownTagsXML() { // @codingStandardsIgnoreStart Generic.Files.LineLength - return array( - array( + return [ + [ <<< EOF @@ -68,8 +68,8 @@ EOF , 'noitazinagro tseb eht si ikiWaideM', 'TestImportPage' - ) - ); + ] + ]; // @codingStandardsIgnoreEnd } @@ -102,8 +102,8 @@ EOF public function getRedirectXML() { // @codingStandardsIgnoreStart Generic.Files.LineLength - return array( - array( + return [ + [ <<< EOF @@ -129,8 +129,8 @@ EOF EOF , 'Test22' - ), - array( + ], + [ <<< EOF @@ -154,8 +154,8 @@ EOF EOF , null - ), - ); + ], + ]; // @codingStandardsIgnoreEnd } @@ -185,8 +185,8 @@ EOF public function getSiteInfoXML() { // @codingStandardsIgnoreStart Generic.Files.LineLength - return array( - array( + return [ + [ <<< EOF @@ -204,7 +204,7 @@ EOF EOF , - array( + [ '-2' => 'Media', '-1' => 'Special', '0' => '', @@ -213,9 +213,9 @@ EOF '3' => 'User talk', '100' => 'Portal', '101' => 'Portal talk', - ) - ), - ); + ] + ], + ]; // @codingStandardsIgnoreEnd } diff --git a/tests/phpunit/includes/libs/CSSMinTest.php b/tests/phpunit/includes/libs/CSSMinTest.php index 8902ecd4be..5f5a1e8f01 100644 --- a/tests/phpunit/includes/libs/CSSMinTest.php +++ b/tests/phpunit/includes/libs/CSSMinTest.php @@ -189,192 +189,192 @@ class CSSMinTest extends MediaWikiTestCase { . '%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( + return [ + [ 'Regular file', 'foo { background: url(red.gif); }', 'foo { background: url(http://localhost/w/red.gif?34ac6); }', - ), - array( + ], + [ 'Regular file (missing)', 'foo { background: url(theColorOfHerHair.gif); }', 'foo { background: url(http://localhost/w/theColorOfHerHair.gif); }', - ), - array( + ], + [ 'Remote URL', 'foo { background: url(http://example.org/w/foo.png); }', 'foo { background: url(http://example.org/w/foo.png); }', - ), - array( + ], + [ 'Protocol-relative remote URL', 'foo { background: url(//example.org/w/foo.png); }', 'foo { background: url(//example.org/w/foo.png); }', - ), - array( + ], + [ 'Remote URL with query', 'foo { background: url(http://example.org/w/foo.png?query=yes); }', 'foo { background: url(http://example.org/w/foo.png?query=yes); }', - ), - array( + ], + [ 'Protocol-relative remote URL with query', 'foo { background: url(//example.org/w/foo.png?query=yes); }', 'foo { background: url(//example.org/w/foo.png?query=yes); }', - ), - array( + ], + [ 'Domain-relative URL', 'foo { background: url(/static/foo.png); }', 'foo { background: url(http://doc.example.org/static/foo.png); }', - ), - array( + ], + [ 'Domain-relative URL with query', 'foo { background: url(/static/foo.png?query=yes); }', 'foo { background: url(http://doc.example.org/static/foo.png?query=yes); }', - ), - array( + ], + [ 'Remote URL (unnecessary quotes not preserved)', 'foo { background: url("http://example.org/w/foo.png"); }', 'foo { background: url(http://example.org/w/foo.png); }', - ), - array( + ], + [ 'Embedded file', 'foo { /* @embed */ background: url(red.gif); }', "foo { background: url($red); background: url(http://localhost/w/red.gif?34ac6)!ie; }", - ), - array( + ], + [ 'Embedded file, other comments before the rule', "foo { /* Bar. */ /* @embed */ background: url(red.gif); }", "foo { /* Bar. */ background: url($red); /* Bar. */ background: url(http://localhost/w/red.gif?34ac6)!ie; }", - ), - array( + ], + [ 'Can not re-embed data: URIs', "foo { /* @embed */ background: url($red); }", "foo { background: url($red); }", - ), - array( + ], + [ 'Can not remap data: URIs', "foo { background: url($red); }", "foo { background: url($red); }", - ), - array( + ], + [ 'Can not embed remote URLs', 'foo { /* @embed */ background: url(http://example.org/w/foo.png); }', 'foo { background: url(http://example.org/w/foo.png); }', - ), - array( + ], + [ 'Embedded file (inline @embed)', 'foo { background: /* @embed */ url(red.gif); }', "foo { background: url($red); " . "background: url(http://localhost/w/red.gif?34ac6)!ie; }", - ), - array( + ], + [ 'Can not embed large files', 'foo { /* @embed */ background: url(large.png); }', "foo { background: url(http://localhost/w/large.png?e3d1f); }", - ), - array( + ], + [ 'SVG files are embedded without base64 encoding and unnecessary IE 6 and 7 fallback', 'foo { /* @embed */ background: url(circle.svg); }', "foo { background: url($svg); }", - ), - array( + ], + [ 'Two regular files in one rule', 'foo { background: url(red.gif), url(green.gif); }', 'foo { background: url(http://localhost/w/red.gif?34ac6), ' . 'url(http://localhost/w/green.gif?13651); }', - ), - array( + ], + [ 'Two embedded files in one rule', 'foo { /* @embed */ background: url(red.gif), url(green.gif); }', "foo { background: url($red), url($green); " . "background: url(http://localhost/w/red.gif?34ac6), " . "url(http://localhost/w/green.gif?13651)!ie; }", - ), - array( + ], + [ 'Two embedded files in one rule (inline @embed)', 'foo { background: /* @embed */ url(red.gif), /* @embed */ url(green.gif); }', "foo { background: url($red), url($green); " . "background: url(http://localhost/w/red.gif?34ac6), " . "url(http://localhost/w/green.gif?13651)!ie; }", - ), - array( + ], + [ 'Two embedded files in one rule (inline @embed), one too large', 'foo { background: /* @embed */ url(red.gif), /* @embed */ url(large.png); }', "foo { background: url($red), url(http://localhost/w/large.png?e3d1f); " . "background: url(http://localhost/w/red.gif?34ac6), " . "url(http://localhost/w/large.png?e3d1f)!ie; }", - ), - array( + ], + [ 'Practical example with some noise', 'foo { /* @embed */ background: #f9f9f9 url(red.gif) 0 0 no-repeat; }', "foo { background: #f9f9f9 url($red) 0 0 no-repeat; " . "background: #f9f9f9 url(http://localhost/w/red.gif?34ac6) 0 0 no-repeat!ie; }", - ), - array( + ], + [ 'Does not mess with other properties', 'foo { color: red; background: url(red.gif); font-size: small; }', 'foo { color: red; background: url(http://localhost/w/red.gif?34ac6); font-size: small; }', - ), - array( + ], + [ 'Spacing and miscellanea not changed (1)', 'foo { background: url(red.gif); }', 'foo { background: url(http://localhost/w/red.gif?34ac6); }', - ), - array( + ], + [ 'Spacing and miscellanea not changed (2)', 'foo {background:url(red.gif)}', 'foo {background:url(http://localhost/w/red.gif?34ac6)}', - ), - array( + ], + [ 'Spaces within url() parentheses are ignored', 'foo { background: url( red.gif ); }', 'foo { background: url(http://localhost/w/red.gif?34ac6); }', - ), - array( + ], + [ '@import rule to local file (should we remap this?)', '@import url(/styles.css)', '@import url(http://doc.example.org/styles.css)', - ), - array( + ], + [ '@import rule to URL (should we remap this?)', '@import url(//localhost/styles.css?query=yes)', '@import url(//localhost/styles.css?query=yes)', - ), - array( + ], + [ 'Simple case with comments before url', 'foo { prop: /* some {funny;} comment */ url(bar.png); }', 'foo { prop: /* some {funny;} comment */ url(http://localhost/w/bar.png); }', - ), - array( + ], + [ 'Simple case with comments after url', 'foo { prop: url(red.gif)/* some {funny;} comment */ ; }', 'foo { prop: url(http://localhost/w/red.gif?34ac6)/* some {funny;} comment */ ; }', - ), - array( + ], + [ 'Embedded file with comment before url', 'foo { /* @embed */ background: /* some {funny;} comment */ url(red.gif); }', "foo { background: /* some {funny;} comment */ url($red); background: /* some {funny;} comment */ url(http://localhost/w/red.gif?34ac6)!ie; }", - ), - array( + ], + [ 'Embedded file with comments inside and outside the rule', 'foo { /* @embed */ background: url(red.gif) /* some {foo;} comment */; /* some {bar;} comment */ }', "foo { background: url($red) /* some {foo;} comment */; background: url(http://localhost/w/red.gif?34ac6) /* some {foo;} comment */!ie; /* some {bar;} comment */ }", - ), - array( + ], + [ 'Embedded file with comment outside the rule', 'foo { /* @embed */ background: url(red.gif); /* some {funny;} comment */ }', "foo { background: url($red); background: url(http://localhost/w/red.gif?34ac6)!ie; /* some {funny;} comment */ }", - ), - array( + ], + [ 'Rule with two urls, each with comments', '{ background: /*asd*/ url(something.png); background: /*jkl*/ url(something.png); }', '{ background: /*asd*/ url(http://localhost/w/something.png); background: /*jkl*/ url(http://localhost/w/something.png); }', - ), - array( + ], + [ 'Sanity check for offending line from jquery.ui.theme.css (bug 60077)', '.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }', '.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/media/GIFTest.php b/tests/phpunit/includes/media/GIFTest.php index bf2389065f..f24b68baf6 100644 --- a/tests/phpunit/includes/media/GIFTest.php +++ b/tests/phpunit/includes/media/GIFTest.php @@ -78,7 +78,10 @@ class GIFHandlerTest extends MediaWikiMediaTestCase { [ null, GIFHandler::METADATA_BAD ], [ '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 ), + [ + '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 ]; } @@ -98,8 +101,14 @@ class GIFHandlerTest extends MediaWikiMediaTestCase { public static function provideGetMetadata() { return [ // @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;}}' ), + [ + '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;}}' + ], + [ + '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/PNGTest.php b/tests/phpunit/includes/media/PNGTest.php index 4417c4f42f..afc338e13c 100644 --- a/tests/phpunit/includes/media/PNGTest.php +++ b/tests/phpunit/includes/media/PNGTest.php @@ -79,7 +79,10 @@ class PNGHandlerTest extends MediaWikiMediaTestCase { [ null, PNGHandler::METADATA_BAD ], [ 'Something invalid!', PNGHandler::METADATA_BAD ], // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong - array( 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:8;s:9:"colorType";s:10:"truecolour";s:8:"metadata";a:1:{s:15:"_MW_PNG_VERSION";i:1;}}', PNGHandler::METADATA_GOOD ), + [ + 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:8;s:9:"colorType";s:10:"truecolour";s:8:"metadata";a:1:{s:15:"_MW_PNG_VERSION";i:1;}}', + PNGHandler::METADATA_GOOD + ], // @codingStandardsIgnoreEnd ]; } @@ -100,8 +103,14 @@ class PNGHandlerTest extends MediaWikiMediaTestCase { public static function provideGetMetadata() { return [ // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong - array( 'rgb-na-png.png', 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:8;s:9:"colorType";s:10:"truecolour";s:8:"metadata";a:1:{s:15:"_MW_PNG_VERSION";i:1;}}' ), - array( 'xmp.png', 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:1;s:9:"colorType";s:14:"index-coloured";s:8:"metadata";a:2:{s:12:"SerialNumber";s:9:"123456789";s:15:"_MW_PNG_VERSION";i:1;}}' ), + [ + 'rgb-na-png.png', + 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:8;s:9:"colorType";s:10:"truecolour";s:8:"metadata";a:1:{s:15:"_MW_PNG_VERSION";i:1;}}' + ], + [ + 'xmp.png', + 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:1;s:9:"colorType";s:14:"index-coloured";s:8:"metadata";a:2:{s:12:"SerialNumber";s:9:"123456789";s:15:"_MW_PNG_VERSION";i:1;}}' + ], // @codingStandardsIgnoreEnd ]; } diff --git a/tests/phpunit/includes/media/WebPTest.php b/tests/phpunit/includes/media/WebPTest.php index dfa92f1f8a..f51693d476 100644 --- a/tests/phpunit/includes/media/WebPTest.php +++ b/tests/phpunit/includes/media/WebPTest.php @@ -20,53 +20,53 @@ class WebPHandlerTest extends MediaWikiTestCase { } public function provideTestExtractMetaData() { // @codingStandardsIgnoreStart Generic.Files.LineLength - return array( + return [ // 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", - array( 'compression' => 'lossless', 'width' => 400, 'height' => 301 ) ), - array( "\x52\x49\x46\x46\x64\x5B\x00\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x10\x00\x00\x00\x8F\x01\x00\x2C\x01\x00\x41\x4C\x50\x48\xE5\x0E", - array( 'compression' => 'unknown', 'animated' => false, 'transparency' => true, 'width' => 400, 'height' => 301 ) ), - array( "\x52\x49\x46\x46\xA8\x72\x00\x00\x57\x45\x42\x50\x56\x50\x38\x4C\x9B\x72\x00\x00\x2F\x81\x81\x62\x10\x8D\x40\x8C\x24\x39\x6E\x73\x73\x38\x01\x96", - array( 'compression' => 'lossless', 'width' => 386, 'height' => 395 ) ), - array( "\x52\x49\x46\x46\xE0\x42\x00\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x10\x00\x00\x00\x81\x01\x00\x8A\x01\x00\x41\x4C\x50\x48\x56\x10", - array( 'compression' => 'unknown', 'animated' => false, 'transparency' => true, 'width' => 386, 'height' => 395 ) ), - array( "\x52\x49\x46\x46\x70\x61\x02\x00\x57\x45\x42\x50\x56\x50\x38\x4C\x63\x61\x02\x00\x2F\x1F\xC3\x95\x10\x8D\xC8\x72\xDB\xC8\x92\x24\xD8\x91\xD9\x91", - array( 'compression' => 'lossless', 'width' => 800, 'height' => 600 ) ), - array( "\x52\x49\x46\x46\x1C\x1D\x01\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x10\x00\x00\x00\x1F\x03\x00\x57\x02\x00\x41\x4C\x50\x48\x25\x8B", - array( 'compression' => 'unknown', 'animated' => false, 'transparency' => true, 'width' => 800, 'height' => 600 ) ), - array( "\x52\x49\x46\x46\xFA\xC5\x00\x00\x57\x45\x42\x50\x56\x50\x38\x4C\xEE\xC5\x00\x00\x2F\xA4\x81\x28\x10\x8D\x40\x68\x24\xC9\x91\xA4\xAE\xF3\x97\x75", - array( 'compression' => 'lossless', 'width' => 421, 'height' => 163 ) ), - array( "\x52\x49\x46\x46\xF6\x5D\x00\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x10\x00\x00\x00\xA4\x01\x00\xA2\x00\x00\x41\x4C\x50\x48\x38\x1A", - array( 'compression' => 'unknown', 'animated' => false, 'transparency' => true, 'width' => 421, 'height' => 163 ) ), - array( "\x52\x49\x46\x46\xC4\x96\x01\x00\x57\x45\x42\x50\x56\x50\x38\x4C\xB8\x96\x01\x00\x2F\x2B\xC1\x4A\x10\x11\x87\x6D\xDB\x48\x12\xFC\x60\xB0\x83\x24", - array( 'compression' => 'lossless', 'width' => 300, 'height' => 300 ) ), - array( "\x52\x49\x46\x46\x0A\x11\x01\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x10\x00\x00\x00\x2B\x01\x00\x2B\x01\x00\x41\x4C\x50\x48\x67\x6E", - array( 'compression' => 'unknown', 'animated' => false, 'transparency' => true, 'width' => 300, 'height' => 300 ) ), + [ "\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", + [ 'compression' => 'lossless', 'width' => 400, 'height' => 301 ] ], + [ "\x52\x49\x46\x46\x64\x5B\x00\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x10\x00\x00\x00\x8F\x01\x00\x2C\x01\x00\x41\x4C\x50\x48\xE5\x0E", + [ 'compression' => 'unknown', 'animated' => false, 'transparency' => true, 'width' => 400, 'height' => 301 ] ], + [ "\x52\x49\x46\x46\xA8\x72\x00\x00\x57\x45\x42\x50\x56\x50\x38\x4C\x9B\x72\x00\x00\x2F\x81\x81\x62\x10\x8D\x40\x8C\x24\x39\x6E\x73\x73\x38\x01\x96", + [ 'compression' => 'lossless', 'width' => 386, 'height' => 395 ] ], + [ "\x52\x49\x46\x46\xE0\x42\x00\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x10\x00\x00\x00\x81\x01\x00\x8A\x01\x00\x41\x4C\x50\x48\x56\x10", + [ 'compression' => 'unknown', 'animated' => false, 'transparency' => true, 'width' => 386, 'height' => 395 ] ], + [ "\x52\x49\x46\x46\x70\x61\x02\x00\x57\x45\x42\x50\x56\x50\x38\x4C\x63\x61\x02\x00\x2F\x1F\xC3\x95\x10\x8D\xC8\x72\xDB\xC8\x92\x24\xD8\x91\xD9\x91", + [ 'compression' => 'lossless', 'width' => 800, 'height' => 600 ] ], + [ "\x52\x49\x46\x46\x1C\x1D\x01\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x10\x00\x00\x00\x1F\x03\x00\x57\x02\x00\x41\x4C\x50\x48\x25\x8B", + [ 'compression' => 'unknown', 'animated' => false, 'transparency' => true, 'width' => 800, 'height' => 600 ] ], + [ "\x52\x49\x46\x46\xFA\xC5\x00\x00\x57\x45\x42\x50\x56\x50\x38\x4C\xEE\xC5\x00\x00\x2F\xA4\x81\x28\x10\x8D\x40\x68\x24\xC9\x91\xA4\xAE\xF3\x97\x75", + [ 'compression' => 'lossless', 'width' => 421, 'height' => 163 ] ], + [ "\x52\x49\x46\x46\xF6\x5D\x00\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x10\x00\x00\x00\xA4\x01\x00\xA2\x00\x00\x41\x4C\x50\x48\x38\x1A", + [ 'compression' => 'unknown', 'animated' => false, 'transparency' => true, 'width' => 421, 'height' => 163 ] ], + [ "\x52\x49\x46\x46\xC4\x96\x01\x00\x57\x45\x42\x50\x56\x50\x38\x4C\xB8\x96\x01\x00\x2F\x2B\xC1\x4A\x10\x11\x87\x6D\xDB\x48\x12\xFC\x60\xB0\x83\x24", + [ 'compression' => 'lossless', 'width' => 300, 'height' => 300 ] ], + [ "\x52\x49\x46\x46\x0A\x11\x01\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x10\x00\x00\x00\x2B\x01\x00\x2B\x01\x00\x41\x4C\x50\x48\x67\x6E", + [ 'compression' => 'unknown', 'animated' => false, 'transparency' => true, 'width' => 300, 'height' => 300 ] ], // Lossy files from https://developers.google.com/speed/webp/gallery1 - array( "\x52\x49\x46\x46\x68\x76\x00\x00\x57\x45\x42\x50\x56\x50\x38\x20\x5C\x76\x00\x00\xD2\xBE\x01\x9D\x01\x2A\x26\x02\x70\x01\x3E\xD5\x4E\x97\x43\xA2", - array( 'compression' => 'lossy', 'width' => 550, 'height' => 368 ) ), - array( "\x52\x49\x46\x46\xB0\xEC\x00\x00\x57\x45\x42\x50\x56\x50\x38\x20\xA4\xEC\x00\x00\xB2\x4B\x02\x9D\x01\x2A\x26\x02\x94\x01\x3E\xD1\x50\x96\x46\x26", - array( 'compression' => 'lossy', 'width' => 550, 'height' => 404 ) ), - array( "\x52\x49\x46\x46\x7A\x19\x03\x00\x57\x45\x42\x50\x56\x50\x38\x20\x6E\x19\x03\x00\xB2\xF8\x09\x9D\x01\x2A\x00\x05\xD0\x02\x3E\xAD\x46\x99\x4A\xA5", - array( 'compression' => 'lossy', 'width' => 1280, 'height' => 720 ) ), - array( "\x52\x49\x46\x46\x44\xB3\x02\x00\x57\x45\x42\x50\x56\x50\x38\x20\x38\xB3\x02\x00\x52\x57\x06\x9D\x01\x2A\x00\x04\x04\x03\x3E\xA5\x44\x96\x49\x26", - array( 'compression' => 'lossy', 'width' => 1024, 'height' => 772 ) ), - array( "\x52\x49\x46\x46\x02\x43\x01\x00\x57\x45\x42\x50\x56\x50\x38\x20\xF6\x42\x01\x00\x12\xC0\x05\x9D\x01\x2A\x00\x04\xF0\x02\x3E\x79\x34\x93\x47\xA4", - array( 'compression' => 'lossy', 'width' => 1024, 'height' => 752 ) ), + [ "\x52\x49\x46\x46\x68\x76\x00\x00\x57\x45\x42\x50\x56\x50\x38\x20\x5C\x76\x00\x00\xD2\xBE\x01\x9D\x01\x2A\x26\x02\x70\x01\x3E\xD5\x4E\x97\x43\xA2", + [ 'compression' => 'lossy', 'width' => 550, 'height' => 368 ] ], + [ "\x52\x49\x46\x46\xB0\xEC\x00\x00\x57\x45\x42\x50\x56\x50\x38\x20\xA4\xEC\x00\x00\xB2\x4B\x02\x9D\x01\x2A\x26\x02\x94\x01\x3E\xD1\x50\x96\x46\x26", + [ 'compression' => 'lossy', 'width' => 550, 'height' => 404 ] ], + [ "\x52\x49\x46\x46\x7A\x19\x03\x00\x57\x45\x42\x50\x56\x50\x38\x20\x6E\x19\x03\x00\xB2\xF8\x09\x9D\x01\x2A\x00\x05\xD0\x02\x3E\xAD\x46\x99\x4A\xA5", + [ 'compression' => 'lossy', 'width' => 1280, 'height' => 720 ] ], + [ "\x52\x49\x46\x46\x44\xB3\x02\x00\x57\x45\x42\x50\x56\x50\x38\x20\x38\xB3\x02\x00\x52\x57\x06\x9D\x01\x2A\x00\x04\x04\x03\x3E\xA5\x44\x96\x49\x26", + [ 'compression' => 'lossy', 'width' => 1024, 'height' => 772 ] ], + [ "\x52\x49\x46\x46\x02\x43\x01\x00\x57\x45\x42\x50\x56\x50\x38\x20\xF6\x42\x01\x00\x12\xC0\x05\x9D\x01\x2A\x00\x04\xF0\x02\x3E\x79\x34\x93\x47\xA4", + [ 'compression' => 'lossy', 'width' => 1024, 'height' => 752 ] ], // Animated file from https://groups.google.com/a/chromium.org/d/topic/blink-dev/Y8tRC4mdQz8/discussion - array( "\x52\x49\x46\x46\xD0\x0B\x02\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x12\x00\x00\x00\x3F\x01\x00\x3F\x01\x00\x41\x4E", - array( 'compression' => 'unknown', 'animated' => true, 'transparency' => true, 'width' => 320, 'height' => 320 ) ), + [ "\x52\x49\x46\x46\xD0\x0B\x02\x00\x57\x45\x42\x50\x56\x50\x38\x58\x0A\x00\x00\x00\x12\x00\x00\x00\x3F\x01\x00\x3F\x01\x00\x41\x4E", + [ 'compression' => 'unknown', 'animated' => true, 'transparency' => true, 'width' => 320, 'height' => 320 ] ], // Error cases - array( '', false ), - array( ' ', false ), - array( 'RIFF ', false ), - array( 'RIFF1234WEBP ', false ), - array( 'RIFF1234WEBPVP8 ', false ), - array( 'RIFF1234WEBPVP8L ', false ), - ); + [ '', false ], + [ ' ', false ], + [ 'RIFF ', false ], + [ 'RIFF1234WEBP ', false ], + [ 'RIFF1234WEBPVP8 ', false ], + [ 'RIFF1234WEBPVP8L ', false ], + ]; // @codingStandardsIgnoreEnd } diff --git a/tests/phpunit/includes/parser/PreprocessorTest.php b/tests/phpunit/includes/parser/PreprocessorTest.php index e55b9e5ca3..420460195d 100644 --- a/tests/phpunit/includes/parser/PreprocessorTest.php +++ b/tests/phpunit/includes/parser/PreprocessorTest.php @@ -29,93 +29,93 @@ class PreprocessorTest extends MediaWikiTestCase { public static function provideCases() { // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong - return array( - array( "Foo", "Foo" ), - array( "", "<!-- Foo -->" ), - array( "", "<!-- Foo --><!-- Bar -->" ), - array( " ", "<!-- Foo --> <!-- Bar -->" ), - array( " \n ", "<!-- Foo --> \n <!-- Bar -->" ), - array( " \n \n", "<!-- Foo --> \n <!-- Bar -->\n" ), - array( " \n", "<!-- Foo --> <!-- Bar -->\n" ), - array( "Bar", "<!-->Bar" ), - array( "\n== Baz ==\n", "== Foo ==\n <!-- Bar -->\n== Baz ==\n" ), - array( "", "gallery" ), - array( "Foo Bar", "Foo gallery Bar" ), - array( "", "gallery</gallery>" ), - array( " ", "<foo> gallery</gallery>" ), - array( " ", "<foo> gallery<gallery></gallery>" ), - array( " Foo bar ", "<noinclude> Foo bar </noinclude>" ), - array( "\n{{Foo}}\n", "<noinclude>\n\n</noinclude>" ), - array( "\n{{Foo}}\n\n", "<noinclude>\n\n</noinclude>\n" ), - array( "foo bar", "galleryfoo bar" ), - array( "<{{foo}}>", "<>" ), - array( "<{{{foo}}}>", "<foo>" ), - array( "", "gallery</gallery</gallery>" ), - array( "=== Foo === ", "=== Foo === " ), - array( "=== Foo === ", "==<!-- -->= Foo === " ), - array( "=== Foo === ", "=== Foo ==<!-- -->= " ), - array( "=== Foo ===\n", "=== Foo ===<!-- -->\n" ), - array( "=== Foo === \n", "=== Foo ===<!-- --> <!-- -->\n" ), - array( "== Foo ==\n== Bar == \n", "== Foo ==\n== Bar == \n" ), - array( "===========", "===========" ), - array( "Foo\n=\n==\n=\n", "Foo\n=\n==\n=\n" ), - array( "{{Foo}}", "" ), - array( "\n{{Foo}}", "\n" ), - array( "{{Foo|bar}}", "" ), - array( "{{Foo|bar}}a", "a" ), - array( "{{Foo|bar|baz}}", "" ), - array( "{{Foo|1=bar}}", "" ), - array( "{{Foo|=bar}}", "" ), - array( "{{Foo|bar=baz}}", "" ), - array( "{{Foo|{{bar}}=baz}}", "" ), - array( "{{Foo|1=bar|baz}}", "" ), - array( "{{Foo|1=bar|2=baz}}", "" ), - array( "{{Foo|bar|foo=baz}}", "" ), - array( "{{{1}}}", "1" ), - array( "{{{1|}}}", "1" ), - array( "{{{Foo}}}", "Foo" ), - array( "{{{Foo|}}}", "Foo" ), - array( "{{{Foo|bar|baz}}}", "Foobarbaz" ), - array( "{{Foo}}", "{<!-- -->{Foo}}" ), - array( "{{{{Foobar}}}}", "{Foobar}" ), - array( "{{{ {{Foo}} }}}", " <template><title>Foo " ), - array( "{{ {{{Foo}}} }}", "" ), - array( "{{{{{Foo}}}}}", "" ), - array( "{{{{{Foo}} }}}", "<template><title>Foo " ), - array( "{{{{{{Foo}}}}}}", "<tplarg><title>Foo" ), - array( "{{{{{{Foo}}}}}", "{" ), - array( "[[[Foo]]", "[[[Foo]]" ), - array( "{{Foo|[[[[bar]]|baz]]}}", "" ), // This test is important, since it means the difference between having the [[ rule stacked or not - array( "{{Foo|[[[[bar]|baz]]}}", "{{Foo|[[[[bar]|baz]]}}" ), - array( "{{Foo|Foo [[[[bar]|baz]]}}", "{{Foo|Foo [[[[bar]|baz]]}}" ), - array( "Foo BarBaz", "Foo display mapBar</display map >Baz" ), - array( "Foo BarBaz", "Foo display map fooBar</display map >Baz" ), - array( "Foo ", "Foo gallery bar="baz" " ), - array( "Foo ", "Foo gallery bar="1" baz=2 " ), - array( "Foo", "/fooFoo<//foo>" ), # Worth blacklisting IMHO - array( "{{#ifexpr: ({{{1|1}}} = 2) | Foo | Bar }}", "" ), - array( "{{#if: {{{1|}}} | Foo | {{Bar}} }}", "" ), - array( "{{#if: {{{1|}}} | Foo | [[Bar]] }}", "" ), - array( "{{#if: {{{1|}}} | [[Foo]] | Bar }}", "" ), - array( "{{#if: {{{1|}}} | 1 | {{#if: {{{1|}}} | 2 | 3 }} }}", "" ), - array( "{{ {{Foo}}", "{{ " ), - array( "{{Foobar {{Foo}} {{Bar}} {{Baz}} ", "{{Foobar " ), - array( "[[Foo]] |", "[[Foo]] |" ), - array( "{{Foo|Bar|", "{{Foo|Bar|" ), - array( "[[Foo]", "[[Foo]" ), - array( "[[Foo|Bar]", "[[Foo|Bar]" ), - array( "{{Foo| [[Bar] }}", "{{Foo| [[Bar] }}" ), - array( "{{Foo| [[Bar|Baz] }}", "{{Foo| [[Bar|Baz] }}" ), - array( "{{Foo|bar=[[baz]}}", "{{Foo|bar=[[baz]}}" ), - array( "{{foo|", "{{foo|" ), - array( "{{foo|}", "{{foo|}" ), - array( "{{foo|} }}", "" ), - array( "{{foo|bar=|}", "{{foo|bar=|}" ), - array( "{{Foo|} Bar=", "{{Foo|} Bar=" ), - array( "{{Foo|} Bar=}}", "" ), - /* array( file_get_contents( __DIR__ . '/QuoteQuran.txt' ), file_get_contents( __DIR__ . '/QuoteQuranExpanded.txt' ) ), */ - ); + return [ + [ "Foo", "Foo" ], + [ "", "<!-- Foo -->" ], + [ "", "<!-- Foo --><!-- Bar -->" ], + [ " ", "<!-- Foo --> <!-- Bar -->" ], + [ " \n ", "<!-- Foo --> \n <!-- Bar -->" ], + [ " \n \n", "<!-- Foo --> \n <!-- Bar -->\n" ], + [ " \n", "<!-- Foo --> <!-- Bar -->\n" ], + [ "Bar", "<!-->Bar" ], + [ "\n== Baz ==\n", "== Foo ==\n <!-- Bar -->\n== Baz ==\n" ], + [ "", "gallery" ], + [ "Foo Bar", "Foo gallery Bar" ], + [ "", "gallery</gallery>" ], + [ " ", "<foo> gallery</gallery>" ], + [ " ", "<foo> gallery<gallery></gallery>" ], + [ " Foo bar ", "<noinclude> Foo bar </noinclude>" ], + [ "\n{{Foo}}\n", "<noinclude>\n\n</noinclude>" ], + [ "\n{{Foo}}\n\n", "<noinclude>\n\n</noinclude>\n" ], + [ "foo bar", "galleryfoo bar" ], + [ "<{{foo}}>", "<>" ], + [ "<{{{foo}}}>", "<foo>" ], + [ "", "gallery</gallery</gallery>" ], + [ "=== Foo === ", "=== Foo === " ], + [ "=== Foo === ", "==<!-- -->= Foo === " ], + [ "=== Foo === ", "=== Foo ==<!-- -->= " ], + [ "=== Foo ===\n", "=== Foo ===<!-- -->\n" ], + [ "=== Foo === \n", "=== Foo ===<!-- --> <!-- -->\n" ], + [ "== Foo ==\n== Bar == \n", "== Foo ==\n== Bar == \n" ], + [ "===========", "===========" ], + [ "Foo\n=\n==\n=\n", "Foo\n=\n==\n=\n" ], + [ "{{Foo}}", "" ], + [ "\n{{Foo}}", "\n" ], + [ "{{Foo|bar}}", "" ], + [ "{{Foo|bar}}a", "a" ], + [ "{{Foo|bar|baz}}", "" ], + [ "{{Foo|1=bar}}", "" ], + [ "{{Foo|=bar}}", "" ], + [ "{{Foo|bar=baz}}", "" ], + [ "{{Foo|{{bar}}=baz}}", "" ], + [ "{{Foo|1=bar|baz}}", "" ], + [ "{{Foo|1=bar|2=baz}}", "" ], + [ "{{Foo|bar|foo=baz}}", "" ], + [ "{{{1}}}", "1" ], + [ "{{{1|}}}", "1" ], + [ "{{{Foo}}}", "Foo" ], + [ "{{{Foo|}}}", "Foo" ], + [ "{{{Foo|bar|baz}}}", "Foobarbaz" ], + [ "{{Foo}}", "{<!-- -->{Foo}}" ], + [ "{{{{Foobar}}}}", "{Foobar}" ], + [ "{{{ {{Foo}} }}}", " <template><title>Foo " ], + [ "{{ {{{Foo}}} }}", "" ], + [ "{{{{{Foo}}}}}", "" ], + [ "{{{{{Foo}} }}}", "<template><title>Foo " ], + [ "{{{{{{Foo}}}}}}", "<tplarg><title>Foo" ], + [ "{{{{{{Foo}}}}}", "{" ], + [ "[[[Foo]]", "[[[Foo]]" ], + [ "{{Foo|[[[[bar]]|baz]]}}", "" ], // This test is important, since it means the difference between having the [[ rule stacked or not + [ "{{Foo|[[[[bar]|baz]]}}", "{{Foo|[[[[bar]|baz]]}}" ], + [ "{{Foo|Foo [[[[bar]|baz]]}}", "{{Foo|Foo [[[[bar]|baz]]}}" ], + [ "Foo BarBaz", "Foo display mapBar</display map >Baz" ], + [ "Foo BarBaz", "Foo display map fooBar</display map >Baz" ], + [ "Foo ", "Foo gallery bar="baz" " ], + [ "Foo ", "Foo gallery bar="1" baz=2 " ], + [ "Foo", "/fooFoo<//foo>" ], # Worth blacklisting IMHO + [ "{{#ifexpr: ({{{1|1}}} = 2) | Foo | Bar }}", "" ], + [ "{{#if: {{{1|}}} | Foo | {{Bar}} }}", "" ], + [ "{{#if: {{{1|}}} | Foo | [[Bar]] }}", "" ], + [ "{{#if: {{{1|}}} | [[Foo]] | Bar }}", "" ], + [ "{{#if: {{{1|}}} | 1 | {{#if: {{{1|}}} | 2 | 3 }} }}", "" ], + [ "{{ {{Foo}}", "{{ " ], + [ "{{Foobar {{Foo}} {{Bar}} {{Baz}} ", "{{Foobar " ], + [ "[[Foo]] |", "[[Foo]] |" ], + [ "{{Foo|Bar|", "{{Foo|Bar|" ], + [ "[[Foo]", "[[Foo]" ], + [ "[[Foo|Bar]", "[[Foo|Bar]" ], + [ "{{Foo| [[Bar] }}", "{{Foo| [[Bar] }}" ], + [ "{{Foo| [[Bar|Baz] }}", "{{Foo| [[Bar|Baz] }}" ], + [ "{{Foo|bar=[[baz]}}", "{{Foo|bar=[[baz]}}" ], + [ "{{foo|", "{{foo|" ], + [ "{{foo|}", "{{foo|}" ], + [ "{{foo|} }}", "" ], + [ "{{foo|bar=|}", "{{foo|bar=|}" ], + [ "{{Foo|} Bar=", "{{Foo|} Bar=" ], + [ "{{Foo|} Bar=}}", "" ], + /* [ file_get_contents( __DIR__ . '/QuoteQuran.txt' ], file_get_contents( __DIR__ . '/QuoteQuranExpanded.txt' ) ], */ + ]; // @codingStandardsIgnoreEnd } @@ -162,13 +162,13 @@ class PreprocessorTest extends MediaWikiTestCase { */ public static function provideFiles() { // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong - return array( - array( "QuoteQuran" ), # http://en.wikipedia.org/w/index.php?title=Template:QuoteQuran/sandbox&oldid=237348988 GFDL + CC BY-SA by Striver - array( "Factorial" ), # http://en.wikipedia.org/w/index.php?title=Template:Factorial&oldid=98548758 GFDL + CC BY-SA by Polonium - array( "All_system_messages" ), # http://tl.wiktionary.org/w/index.php?title=Suleras:All_system_messages&oldid=2765 GPL text generated by MediaWiki - array( "Fundraising" ), # http://tl.wiktionary.org/w/index.php?title=MediaWiki:Sitenotice&oldid=5716 GFDL + CC BY-SA, copied there by Sky Harbor. - array( "NestedTemplates" ), # bug 27936 - ); + return [ + [ "QuoteQuran" ], # http://en.wikipedia.org/w/index.php?title=Template:QuoteQuran/sandbox&oldid=237348988 GFDL + CC BY-SA by Striver + [ "Factorial" ], # http://en.wikipedia.org/w/index.php?title=Template:Factorial&oldid=98548758 GFDL + CC BY-SA by Polonium + [ "All_system_messages" ], # http://tl.wiktionary.org/w/index.php?title=Suleras:All_system_messages&oldid=2765 GPL text generated by MediaWiki + [ "Fundraising" ], # http://tl.wiktionary.org/w/index.php?title=MediaWiki:Sitenotice&oldid=5716 GFDL + CC BY-SA, copied there by Sky Harbor. + [ "NestedTemplates" ], # bug 27936 + ]; // @codingStandardsIgnoreEnd } @@ -197,43 +197,43 @@ class PreprocessorTest extends MediaWikiTestCase { */ public static function provideHeadings() { // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong - return array( /* These should become headings: */ - array( "== h ==", "== h ==<!--c1-->" ), - array( "== h == ", "== h == <!--c1-->" ), - array( "== h == ", "== h ==<!--c1--> " ), - array( "== h == ", "== h == <!--c1--> " ), - array( "== h ==", "== h ==<!--c1--><!--c2-->" ), - array( "== h == ", "== h == <!--c1--><!--c2-->" ), - array( "== h == ", "== h ==<!--c1--><!--c2--> " ), - array( "== h == ", "== h == <!--c1--><!--c2--> " ), - array( "== h == ", "== h == <!--c1--> <!--c2-->" ), - array( "== h == ", "== h ==<!--c1--> <!--c2--> " ), - array( "== h == ", "== h == <!--c1--> <!--c2--> " ), - array( "== h ==", "== h ==<!--c1--><!--c2--><!--c3-->" ), - array( "== h == ", "== h ==<!--c1--> <!--c2--><!--c3-->" ), - array( "== h == ", "== h ==<!--c1--><!--c2--> <!--c3-->" ), - array( "== h == ", "== h ==<!--c1--> <!--c2--> <!--c3-->" ), - array( "== h == ", "== h == <!--c1--><!--c2--><!--c3-->" ), - array( "== h == ", "== h == <!--c1--> <!--c2--><!--c3-->" ), - array( "== h == ", "== h == <!--c1--><!--c2--> <!--c3-->" ), - array( "== h == ", "== h == <!--c1--> <!--c2--> <!--c3-->" ), - array( "== h == ", "== h ==<!--c1--><!--c2--><!--c3--> " ), - array( "== h == ", "== h ==<!--c1--> <!--c2--><!--c3--> " ), - array( "== h == ", "== h ==<!--c1--><!--c2--> <!--c3--> " ), - array( "== h == ", "== h ==<!--c1--> <!--c2--> <!--c3--> " ), - array( "== h == ", "== h == <!--c1--><!--c2--><!--c3--> " ), - array( "== h == ", "== h == <!--c1--> <!--c2--><!--c3--> " ), - array( "== h == ", "== h == <!--c1--><!--c2--> <!--c3--> " ), - array( "== h == ", "== h == <!--c1--> <!--c2--> <!--c3--> " ), - array( "== h == ", "== h ==<!--c1--> <!--c2-->" ), - array( "== h == ", "== h == <!--c1--> <!--c2-->" ), - array( "== h == ", "== h ==<!--c1--> <!--c2--> " ), + return [ /* These should become headings: */ + [ "== h ==", "== h ==<!--c1-->" ], + [ "== h == ", "== h == <!--c1-->" ], + [ "== h == ", "== h ==<!--c1--> " ], + [ "== h == ", "== h == <!--c1--> " ], + [ "== h ==", "== h ==<!--c1--><!--c2-->" ], + [ "== h == ", "== h == <!--c1--><!--c2-->" ], + [ "== h == ", "== h ==<!--c1--><!--c2--> " ], + [ "== h == ", "== h == <!--c1--><!--c2--> " ], + [ "== h == ", "== h == <!--c1--> <!--c2-->" ], + [ "== h == ", "== h ==<!--c1--> <!--c2--> " ], + [ "== h == ", "== h == <!--c1--> <!--c2--> " ], + [ "== h ==", "== h ==<!--c1--><!--c2--><!--c3-->" ], + [ "== h == ", "== h ==<!--c1--> <!--c2--><!--c3-->" ], + [ "== h == ", "== h ==<!--c1--><!--c2--> <!--c3-->" ], + [ "== h == ", "== h ==<!--c1--> <!--c2--> <!--c3-->" ], + [ "== h == ", "== h == <!--c1--><!--c2--><!--c3-->" ], + [ "== h == ", "== h == <!--c1--> <!--c2--><!--c3-->" ], + [ "== h == ", "== h == <!--c1--><!--c2--> <!--c3-->" ], + [ "== h == ", "== h == <!--c1--> <!--c2--> <!--c3-->" ], + [ "== h == ", "== h ==<!--c1--><!--c2--><!--c3--> " ], + [ "== h == ", "== h ==<!--c1--> <!--c2--><!--c3--> " ], + [ "== h == ", "== h ==<!--c1--><!--c2--> <!--c3--> " ], + [ "== h == ", "== h ==<!--c1--> <!--c2--> <!--c3--> " ], + [ "== h == ", "== h == <!--c1--><!--c2--><!--c3--> " ], + [ "== h == ", "== h == <!--c1--> <!--c2--><!--c3--> " ], + [ "== h == ", "== h == <!--c1--><!--c2--> <!--c3--> " ], + [ "== h == ", "== h == <!--c1--> <!--c2--> <!--c3--> " ], + [ "== h == ", "== h ==<!--c1--> <!--c2-->" ], + [ "== h == ", "== h == <!--c1--> <!--c2-->" ], + [ "== h == ", "== h ==<!--c1--> <!--c2--> " ], /* These are not working: */ - array( "== h == x ", "== h == x <!--c1--><!--c2--><!--c3--> " ), - array( "== h == x ", "== h ==<!--c1--> x <!--c2--><!--c3--> " ), - array( "== h == x ", "== h ==<!--c1--><!--c2--><!--c3--> x " ), - ); + [ "== h == x ", "== h == x <!--c1--><!--c2--><!--c3--> " ], + [ "== h == x ", "== h ==<!--c1--> x <!--c2--><!--c3--> " ], + [ "== h == x ", "== h ==<!--c1--><!--c2--><!--c3--> x " ], + ]; // @codingStandardsIgnoreEnd } diff --git a/tests/phpunit/includes/password/BcryptPasswordTest.php b/tests/phpunit/includes/password/BcryptPasswordTest.php index d6940b58f3..8f80362470 100644 --- a/tests/phpunit/includes/password/BcryptPasswordTest.php +++ b/tests/phpunit/includes/password/BcryptPasswordTest.php @@ -13,28 +13,28 @@ class BcryptPasswordTest extends PasswordTestCase { public static function providePasswordTests() { // @codingStandardsIgnoreStart Generic.Files.LineLength - return array( + return [ // Tests from glibc bcrypt implementation - array( true, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', "U*U" ), - array( true, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$VGOzA784oUp/Z0DY336zx7pLYAy0lwK', "U*U*" ), - array( true, ':bcrypt:5$XXXXXXXXXXXXXXXXXXXXXO$AcXxm9kjPGEMsLznoKqmqw7tc8WCx4a', "U*U*U" ), - array( true, ':bcrypt:5$abcdefghijklmnopqrstuu$5s2v8.iXieOjg/.AySBTTZIIVFJeBui', "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789chars after 72 are ignored" ), - array( true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3" ), - array( true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3" ), - array( true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3" ), - array( true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345" ), - array( true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345" ), - array( true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345" ), - array( true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab" ), - array( true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab" ), - array( true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$swQOIzjOiJ9GHEPuhEkvqrUyvWhEMx6', "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaachars after 72 are ignored as usual" ), - array( true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$R9xrDjiycxMbQE2bp.vgqlYpW5wx2yy', "\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55" ), - array( true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$9tQZzcJfm3uj2NvJ/n5xkhpqLrMpWCe', "\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff" ), - array( true, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$7uG0VCzI2bS7j6ymqJi9CdcdxiRTWNy', "" ), + [ true, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', "U*U" ], + [ true, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$VGOzA784oUp/Z0DY336zx7pLYAy0lwK', "U*U*" ], + [ true, ':bcrypt:5$XXXXXXXXXXXXXXXXXXXXXO$AcXxm9kjPGEMsLznoKqmqw7tc8WCx4a', "U*U*U" ], + [ true, ':bcrypt:5$abcdefghijklmnopqrstuu$5s2v8.iXieOjg/.AySBTTZIIVFJeBui', "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789chars after 72 are ignored" ], + [ true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$CE5elHaaO4EbggVDjb8P19RukzXSM3e', "\xff\xff\xa3" ], + [ true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3" ], + [ true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$Sa7shbm4.OzKpvFnX1pQLmQW96oUlCq', "\xa3" ], + [ true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$o./n25XVfn6oAPaUvHe.Csk4zRfsYPi', "\xff\xa334\xff\xff\xff\xa3345" ], + [ true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345" ], + [ true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$nRht2l/HRhr6zmCp9vYUvvsqynflf9e', "\xff\xa3345" ], + [ true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab" ], + [ true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$6IflQkJytoRVc1yuaNtHfiuq.FRlSIS', "\xa3ab" ], + [ true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$swQOIzjOiJ9GHEPuhEkvqrUyvWhEMx6', "\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaa\xaachars after 72 are ignored as usual" ], + [ true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$R9xrDjiycxMbQE2bp.vgqlYpW5wx2yy', "\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55\xaa\x55" ], + [ true, ':bcrypt:5$/OK.fbVrR/bpIqNJ5ianF.$9tQZzcJfm3uj2NvJ/n5xkhpqLrMpWCe', "\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff\x55\xaa\xff" ], + [ true, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$7uG0VCzI2bS7j6ymqJi9CdcdxiRTWNy', "" ], // One or two false sanity tests - array( false, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', "UXU" ), - array( false, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', "" ), - ); + [ false, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', "UXU" ], + [ false, ':bcrypt:5$CCCCCCCCCCCCCCCCCCCCC.$E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW', "" ], + ]; // @codingStandardsIgnoreEnd } } diff --git a/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php b/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php index cccec5fb5c..773f033abb 100644 --- a/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php +++ b/tests/phpunit/includes/password/LayeredParameterizedPasswordTest.php @@ -28,9 +28,13 @@ class LayeredParameterizedPasswordTest extends PasswordTestCase { public static function providePasswordTests() { // @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' ), - ); + return [ + [ + 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 } diff --git a/tests/phpunit/includes/upload/UploadBaseTest.php b/tests/phpunit/includes/upload/UploadBaseTest.php index a274b844e7..ee74957c2c 100644 --- a/tests/phpunit/includes/upload/UploadBaseTest.php +++ b/tests/phpunit/includes/upload/UploadBaseTest.php @@ -136,259 +136,259 @@ class UploadBaseTest extends MediaWikiTestCase { public static function provideCheckSvgScriptCallback() { // @codingStandardsIgnoreStart Generic.Files.LineLength - return array( + return [ // html5sec SVG vectors - array( + [ '', true, true, 'Script tag in svg (http://html5sec.org/#47)' - ), - array( + ], + [ '', true, true, 'SVG with onload property (http://html5sec.org/#11)' - ), - array( + ], + [ '', true, true, 'SVG with onload property (http://html5sec.org/#65)' - ), - array( + ], + [ ' ', true, true, 'SVG with javascript xlink (http://html5sec.org/#87)' - ), - array( + ], + [ ' ', true, true, 'SVG with Opera image xlink (http://html5sec.org/#88 - c)' - ), - array( + ], + [ ' ', true, true, 'SVG with Opera animation xlink (http://html5sec.org/#88 - a)' - ), - array( + ], + [ ' ', true, true, 'SVG with Opera animation xlink (http://html5sec.org/#88 - b)' - ), - array( + ], + [ ' ', true, true, 'SVG with Opera image xlink (http://html5sec.org/#88 - c)' - ), - array( + ], + [ ' ', true, true, 'SVG with Opera foreignObject xlink (http://html5sec.org/#88 - d)' - ), - array( + ], + [ ' ', true, true, 'SVG with Opera foreignObject xlink (http://html5sec.org/#88 - e)' - ), - array( + ], + [ ' ', true, true, 'SVG with event handler set (http://html5sec.org/#89 - a)' - ), - array( + ], + [ ' ', true, true, 'SVG with event handler animate (http://html5sec.org/#89 - a)' - ), - array( + ], + [ ' alert(1) ', true, true, 'SVG with element handler (http://html5sec.org/#94)' - ), - array( + ], + [ ' ', true, true, 'SVG with href to data: url (http://html5sec.org/#95)' - ), - array( + ], + [ ' ', true, true, 'SVG with Tiny handler (http://html5sec.org/#104)' - ), - array( + ], + [ ' ', true, true, 'SVG with new CSS styles properties (http://html5sec.org/#109)' - ), - array( + ], + [ ' ', true, true, 'SVG with new CSS styles properties as attributes' - ), - array( + ], + [ ' ', true, true, 'SVG with new CSS styles properties as attributes (2)' - ), - array( + ], + [ ' ', true, true, 'SVG with path marker-start (http://html5sec.org/#110)' - ), - array( + ], + [ ' ]> ', true, true, 'SVG with embedded stylesheet (http://html5sec.org/#125)' - ), - array( + ], + [ ' alert(1) ', true, true, 'SVG with handler attribute (http://html5sec.org/#127)' - ), - array( + ], + [ // Haven't found a browser that accepts this particular example, but we // don't want to allow embeded svgs, ever ' ', true, true, 'SVG with image filter via style (http://html5sec.org/#129)' - ), - array( + ], + [ // This doesn't seem possible without embedding the svg, but just in case ' ', true, true, 'SVG with animate from (http://html5sec.org/#137)' - ), - array( + ], + [ ' Click me ', true, true, 'SVG with animate xlink:href (http://html5sec.org/#137)' - ), - array( + ], + [ ' Click me ', true, true, 'SVG with animate y:href (http://html5sec.org/#137)' - ), + ], // Other hostile SVG's - array( + [ ' ', true, true, 'SVG with non-local image href (bug 65839)' - ), - array( + ], + [ ' 50 100 ', true, true, 'SVG with remote stylesheet (bug 57550)' - ), - array( + ], + [ ' B ', true, true, 'SVG with rembeded iframe (bug 60771)' - ), - array( + ], + [ ' WebPlatform.org ', true, true, 'SVG with @import in style element (bug 69008)' - ), - array( + ], + [ ' WebPlatform.org ', true, true, 'SVG with @import in style element and child element (bug 69008#c11)' - ), - array( + ], + [ ' WebPlatform.org ', true, true, 'SVG with case-insensitive @import in style element (bug T85349)' - ), - array( + ], + [ ' ', true, true, 'SVG with remote background image (bug 69008)' - ), - array( + ], + [ ' ', true, true, 'SVG with remote background image, encoded (bug 69008)' - ), - array( + ], + [ ' ', true, true, 'SVG with remote background image, in style element (bug 69008)' - ), - array( + ], + [ // This currently doesn't seem to work in any browsers, but in case // http://www.w3.org/TR/css3-images/ is implemented for SVG files ' ', true, true, 'SVG with remote background image using image() (bug 69008)' - ), - array( + ], + [ // As reported by Cure53 ' ', true, true, 'SVG with data:text/html link target (firefox only)' - ), - array( + ], + [ ' ]> &lol2; ', true, true, 'SVG with encoded script tag in internal entity (reported by Beyond Security)' - ), - array( + ], + [ ' ]> &foo; ', false, false, 'SVG with external entity' - ), + ], // Test good, but strange files that we want to allow - array( + [ ' ', true, false, 'SVG with link to a remote site' - ), - array( + ], + [ ' 12345 ', true, false, 'SVG with local urls, including filter: in style' - ), - ); + ], + ]; // @codingStandardsIgnoreEnd } } diff --git a/tests/phpunit/includes/utils/MWCryptHKDFTest.php b/tests/phpunit/includes/utils/MWCryptHKDFTest.php index 17442b8f12..fafd4fa18e 100644 --- a/tests/phpunit/includes/utils/MWCryptHKDFTest.php +++ b/tests/phpunit/includes/utils/MWCryptHKDFTest.php @@ -42,53 +42,58 @@ class MWCryptHKDFTest extends MediaWikiTestCase { public static function providerRfc5869() { // @codingStandardsIgnoreStart Generic.Files.LineLength - return array( + return [ // A.1 - array( 'sha256', + [ + 'sha256', '0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', // ikm '000102030405060708090a0b0c', // salt 'f0f1f2f3f4f5f6f7f8f9', // context 42, // bytes '077709362c2e32df0ddc3f0dc47bba6390b6c73bb50f9c3122ec844ad7c2b3e5', // prk '3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865' // okm - ), + ], // A.2 - array( 'sha256', + [ + 'sha256', '000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f', '606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf', 'b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff', 82, '06a6b88c5853361a06104c9ceb35b45cef760014904671014a193f40c15fc244', 'b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87' - ), + ], // A.3 - array( 'sha256', + [ + 'sha256', '0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', // ikm '', // salt '', // context 42, // bytes '19ef24a32c717b167f33a91d6f648bdf96596776afdb6377ac434c1c293ccb04', // prk '8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8' // okm - ), + ], // A.4 - array( 'sha1', + [ + 'sha1', '0b0b0b0b0b0b0b0b0b0b0b', // ikm '000102030405060708090a0b0c', // salt 'f0f1f2f3f4f5f6f7f8f9', // context 42, // bytes '9b6c18c432a7bf8f0e71c8eb88f4b30baa2ba243', // prk '085a01ea1b10f36933068b56efa5ad81a4f14b822f5b091568a9cdd4f155fda2c22e422478d305f3f896' // okm - ), + ], // A.5 - array( 'sha1', + [ + 'sha1', '000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f', // ikm '606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf', // salt 'b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff', // context 82, // bytes '8adae09a2a307059478d309b26c4115a224cfaf6', // prk '0bd770a74d1160f7c9f12cd5912a06ebff6adcae899d92191fe4305673ba2ffe8fa3f1a4e5ad79f3f334b3b202b2173c486ea37ce3d397ed034c7f9dfeb15c5e927336d0441f4c4300e2cff0d0900b52d3b4' // okm - ), - ); + ], + ]; // @codingStandardsIgnoreEnd } } diff --git a/tests/phpunit/languages/LanguageTest.php b/tests/phpunit/languages/LanguageTest.php index 3f80b90eed..0cf2d0f546 100644 --- a/tests/phpunit/languages/LanguageTest.php +++ b/tests/phpunit/languages/LanguageTest.php @@ -1310,19 +1310,19 @@ class LanguageTest extends LanguageClassesTestCase { public static function provideCheckTitleEncodingData() { // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong - return array( - array( "" ), - array( "United States of America" ), // 7bit ASCII - array( rawurldecode( "S%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e" ) ), - array( + return [ + [ "" ], + [ "United States of America" ], // 7bit ASCII + [ rawurldecode( "S%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e" ) ], + [ rawurldecode( "Acteur%7CAlbert%20Robbins%7CAnglais%7CAnn%20Donahue%7CAnthony%20E.%20Zuiker%7CCarol%20Mendelsohn" ) - ), + ], // The following two data sets come from bug 36839. They fail if checkTitleEncoding uses a regexp to test for // valid UTF-8 encoding and the pcre.recursion_limit is low (like, say, 1024). They succeed if checkTitleEncoding // uses mb_check_encoding for its test. - array( + [ rawurldecode( "Acteur%7CAlbert%20Robbins%7CAnglais%7CAnn%20Donahue%7CAnthony%20E.%20Zuiker%7CCarol%20Mendelsohn%7C" . "Catherine%20Willows%7CDavid%20Hodges%7CDavid%20Phillips%7CGil%20Grissom%7CGreg%20Sanders%7CHodges%7C" @@ -1339,8 +1339,8 @@ class LanguageTest extends LanguageClassesTestCase { . "Sara%20Sidle%7CSofia%20Curtis%7CS%C3%A9rie%20t%C3%A9l%C3%A9vis%C3%A9e%7CWallace%20Langham%7C" . "Warrick%20Brown%7CWendy%20Simms%7C%C3%89tats-Unis" ), - ), - array( + ], + [ rawurldecode( "Mod%C3%A8le%3AArrondissements%20homonymes%7CMod%C3%A8le%3ABandeau%20standard%20pour%20page%20d'homonymie%7C" . "Mod%C3%A8le%3ABatailles%20homonymes%7CMod%C3%A8le%3ACantons%20homonymes%7C" @@ -1358,8 +1358,8 @@ class LanguageTest extends LanguageClassesTestCase { . "Mod%C3%A8le%3ATitres%20homonymes%7CMod%C3%A8le%3AToponymie%7CMod%C3%A8le%3AUnit%C3%A9s%20homonymes%7C" . "Mod%C3%A8le%3AVilles%20homonymes%7CMod%C3%A8le%3A%C3%89difices%20religieux%20homonymes" ) - ) - ); + ] + ]; // @codingStandardsIgnoreEnd } -- 2.20.1