X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2FHooksTest.php;h=527e12927ab1516e363684b26026b64d771396b4;hb=7ed5eb1e71523d43d6d80783079a189b2224e0da;hp=74d4b09131f7d67c888dc57985fee81e01650772;hpb=9f3dd6ceb2193056eea1b334bfca67d546594df1;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/HooksTest.php b/tests/phpunit/includes/HooksTest.php index 74d4b09131..527e12927a 100644 --- a/tests/phpunit/includes/HooksTest.php +++ b/tests/phpunit/includes/HooksTest.php @@ -12,40 +12,40 @@ class HooksTest extends MediaWikiTestCase { public static function provideHooks() { $i = new NothingClass(); - return array( - array( + return [ + [ 'Object and method', - array( $i, 'someNonStatic' ), + [ $i, 'someNonStatic' ], 'changed-nonstatic', 'changed-nonstatic' - ), - array( 'Object and no method', array( $i ), 'changed-onevent', 'original' ), - array( + ], + [ 'Object and no method', [ $i ], 'changed-onevent', 'original' ], + [ 'Object and method with data', - array( $i, 'someNonStaticWithData', 'data' ), + [ $i, 'someNonStaticWithData', 'data' ], 'data', 'original' - ), - array( 'Object and static method', array( $i, 'someStatic' ), 'changed-static', 'original' ), - array( + ], + [ 'Object and static method', [ $i, 'someStatic' ], 'changed-static', 'original' ], + [ 'Class::method static call', - array( 'NothingClass::someStatic' ), + [ 'NothingClass::someStatic' ], 'changed-static', 'original' - ), - array( 'Global function', array( 'NothingFunction' ), 'changed-func', 'original' ), - array( 'Global function with data', array( 'NothingFunctionData', 'data' ), 'data', 'original' ), - array( 'Closure', array( function ( &$foo, $bar ) { + ], + [ 'Global function', [ 'NothingFunction' ], 'changed-func', 'original' ], + [ 'Global function with data', [ 'NothingFunctionData', 'data' ], 'data', 'original' ], + [ 'Closure', [ function ( &$foo, $bar ) { $foo = 'changed-closure'; return true; - } ), 'changed-closure', 'original' ), - array( 'Closure with data', array( function ( $data, &$foo, $bar ) { + } ], 'changed-closure', 'original' ], + [ 'Closure with data', [ function ( $data, &$foo, $bar ) { $foo = $data; return true; - }, 'data' ), 'data', 'original' ) - ); + }, 'data' ], 'data', 'original' ] + ]; } /** @@ -57,7 +57,7 @@ class HooksTest extends MediaWikiTestCase { $foo = $bar = 'original'; $wgHooks['MediaWikiHooksTest001'][] = $hook; - wfRunHooks( 'MediaWikiHooksTest001', array( &$foo, &$bar ) ); + wfRunHooks( 'MediaWikiHooksTest001', [ &$foo, &$bar ] ); $this->assertSame( $expectedFoo, $foo, $msg ); $this->assertSame( $expectedBar, $bar, $msg ); @@ -72,7 +72,7 @@ class HooksTest extends MediaWikiTestCase { $foo = $bar = 'original'; Hooks::register( 'MediaWikiHooksTest001', $hook ); - Hooks::run( 'MediaWikiHooksTest001', array( &$foo, &$bar ) ); + Hooks::run( 'MediaWikiHooksTest001', [ &$foo, &$bar ] ); $this->assertSame( $expectedFoo, $foo, $msg ); $this->assertSame( $expectedBar, $bar, $msg ); @@ -106,7 +106,7 @@ class HooksTest extends MediaWikiTestCase { $foo = 'quux'; $bar = 'qaax'; - Hooks::run( 'MediaWikiHooksTest001', array( &$foo, &$bar ) ); + Hooks::run( 'MediaWikiHooksTest001', [ &$foo, &$bar ] ); $this->assertEquals( 1, $a->calls, @@ -125,7 +125,7 @@ class HooksTest extends MediaWikiTestCase { */ public function testUncallableFunction() { Hooks::register( 'MediaWikiHooksTest001', 'ThisFunctionDoesntExist' ); - Hooks::run( 'MediaWikiHooksTest001', array() ); + Hooks::run( 'MediaWikiHooksTest001', [] ); } /** @@ -141,7 +141,7 @@ class HooksTest extends MediaWikiTestCase { return true; } ); $foo = 'original'; - Hooks::run( 'MediaWikiHooksTest001', array( &$foo ) ); + Hooks::run( 'MediaWikiHooksTest001', [ &$foo ] ); $this->assertSame( 'original', $foo, 'Hooks continued processing after a false return.' ); } @@ -153,7 +153,7 @@ class HooksTest extends MediaWikiTestCase { Hooks::register( 'MediaWikiHooksTest001', function () { return 'test'; } ); - Hooks::run( 'MediaWikiHooksTest001', array() ); + Hooks::run( 'MediaWikiHooksTest001', [] ); } }