diff options
author | X! <soxred93@users.mediawiki.org> | 2011-01-02 06:48:07 +0000 |
---|---|---|
committer | X! <soxred93@users.mediawiki.org> | 2011-01-02 06:48:07 +0000 |
commit | 3589532db41e32bd09d6814674f7afbb0fe65e34 (patch) | |
tree | 037a7bbe055b8e1f0060b2174daae463ef52ba93 /tests/phpunit/includes/MWFunctionTest.php | |
parent | 4cce1efbe7fc7d5c6fdc1647f6f324a5537bf58b (diff) | |
download | mediawikicore-3589532db41e32bd09d6814674f7afbb0fe65e34.tar.gz mediawikicore-3589532db41e32bd09d6814674f7afbb0fe65e34.zip |
Per my comment on r68760: Make MWfunction class, complete with call_user_func helper functions that automatically
make the callback PHP 5.1 compatible with the Class::Method syntax. Add Unit tests to supplement it.
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/79479
Diffstat (limited to 'tests/phpunit/includes/MWFunctionTest.php')
-rw-r--r-- | tests/phpunit/includes/MWFunctionTest.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/phpunit/includes/MWFunctionTest.php b/tests/phpunit/includes/MWFunctionTest.php new file mode 100644 index 000000000000..19eae81e2ae1 --- /dev/null +++ b/tests/phpunit/includes/MWFunctionTest.php @@ -0,0 +1,34 @@ +<?php + +class MWFunctionTest extends MediaWikiTestCase { + + function testCallUserFuncWorkarounds() { + + $this->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(); + } + +} + |