MediaWiki REL1_31
wfGetCallerTest.php
Go to the documentation of this file.
1<?php
2
8 public function testZero() {
9 $this->assertEquals( 'WfGetCallerTest->testZero', wfGetCaller( 1 ) );
10 }
11
12 function callerOne() {
13 return wfGetCaller();
14 }
15
16 public function testOne() {
17 $this->assertEquals( 'WfGetCallerTest->testOne', self::callerOne() );
18 }
19
20 static function intermediateFunction( $level = 2, $n = 0 ) {
21 if ( $n > 0 ) {
22 return self::intermediateFunction( $level, $n - 1 );
23 }
24
25 return wfGetCaller( $level );
26 }
27
28 public function testTwo() {
29 $this->assertEquals( 'WfGetCallerTest->testTwo', self::intermediateFunction() );
30 }
31
32 public function testN() {
33 $this->assertEquals( 'WfGetCallerTest->testN', self::intermediateFunction( 2, 0 ) );
34 $this->assertEquals(
35 'WfGetCallerTest::intermediateFunction',
36 self::intermediateFunction( 1, 0 )
37 );
38
39 for ( $i = 0; $i < 10; $i++ ) {
40 $this->assertEquals(
41 'WfGetCallerTest::intermediateFunction',
42 self::intermediateFunction( $i + 1, $i )
43 );
44 }
45 }
46}
wfGetCaller( $level=2)
Get the name of the function which called this function wfGetCaller( 1 ) is the function with the wfG...
GlobalFunctions wfGetCaller.
static intermediateFunction( $level=2, $n=0)