Slight improvements to FormSpecialPage behavior.
[lhc/web/wiklou.git] / tests / phpunit / includes / GlobalFunctions / wfGetCallerTest.php
1 <?php
2
3 class WfGetCallerTest extends MediaWikiTestCase {
4
5 function testZero() {
6 $this->assertEquals( __METHOD__, wfGetCaller( 1 ) );
7 }
8
9 function callerOne() {
10 return wfGetCaller();
11 }
12
13 function testOne() {
14 $this->assertEquals( 'WfGetCallerTest::testOne', self::callerOne() );
15 }
16
17 function intermediateFunction( $level = 2, $n = 0 ) {
18 if ( $n > 0 ) {
19 return self::intermediateFunction( $level, $n - 1 );
20 }
21 return wfGetCaller( $level );
22 }
23
24 function testTwo() {
25 $this->assertEquals( 'WfGetCallerTest::testTwo', self::intermediateFunction() );
26 }
27
28 function testN() {
29 $this->assertEquals( 'WfGetCallerTest::testN', self::intermediateFunction( 2, 0 ) );
30 $this->assertEquals( 'WfGetCallerTest::intermediateFunction', self::intermediateFunction( 1, 0 ) );
31
32 for ( $i = 0; $i < 10; $i++ ) {
33 $this->assertEquals( 'WfGetCallerTest::intermediateFunction', self::intermediateFunction( $i + 1, $i ) );
34 }
35 }
36 }