aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/MWFunctionTest.php
blob: 19eae81e2ae170f1eae42e11a10e4db88fa41fca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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();
	}
	
}