diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index fefa987c8a4..2c7bfcabb0c 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -166,6 +166,7 @@ $wgAutoloadLocalClasses = array( 'MessageCache' => 'includes/MessageCache.php', 'MimeMagic' => 'includes/MimeMagic.php', 'MWException' => 'includes/Exception.php', + 'MWFunction' => 'includes/MWFunction.php', 'MWHttpRequest' => 'includes/HttpFunctions.php', 'MWMemcached' => 'includes/memcached-client.php', 'MWNamespace' => 'includes/Namespace.php', diff --git a/includes/MWFunction.php b/includes/MWFunction.php new file mode 100644 index 00000000000..3622b694699 --- /dev/null +++ b/includes/MWFunction.php @@ -0,0 +1,52 @@ +assertEquals( + MWFunction::call( 'MWFunctionTest::someMethod' ), + call_user_func( array( 'MWFunctionTest', 'someMethod' ) ) + ); + $this->assertEquals( + MWFunction::call( 'MWFunctionTest::someMethod', 'foo', 'bar', 'baz' ), + call_user_func( array( 'MWFunctionTest', 'someMethod' ), 'foo', 'bar', 'baz' ) + ); + + + + $this->assertEquals( + MWFunction::callArray( 'MWFunctionTest::someMethod', array() ), + call_user_func_array( array( 'MWFunctionTest', 'someMethod' ), array() ) + ); + $this->assertEquals( + MWFunction::callArray( 'MWFunctionTest::someMethod', array( 'foo', 'bar', 'baz' ) ), + call_user_func_array( array( 'MWFunctionTest', 'someMethod' ), array( 'foo', 'bar', 'baz' ) ) + ); + + } + + public static function someMethod() { + return func_get_args(); + } + +} +