Merge "Update docs/hooks.txt for ShowSearchHitTitle"
[mediawiki.git] / tests / phpunit / includes / GlobalFunctions / wfGetCallerTest.php
blob8a7bfa5a8cf38491f9fa59737c3731c12d9aea4f
1 <?php
3 /**
4 * @group GlobalFunctions
5 * @covers ::wfGetCaller
6 */
7 class WfGetCallerTest extends MediaWikiTestCase {
8 public function testZero() {
9 $this->assertEquals( 'WfGetCallerTest->testZero', wfGetCaller( 1 ) );
12 function callerOne() {
13 return wfGetCaller();
16 public function testOne() {
17 $this->assertEquals( 'WfGetCallerTest->testOne', self::callerOne() );
20 static function intermediateFunction( $level = 2, $n = 0 ) {
21 if ( $n > 0 ) {
22 return self::intermediateFunction( $level, $n - 1 );
25 return wfGetCaller( $level );
28 public function testTwo() {
29 $this->assertEquals( 'WfGetCallerTest->testTwo', self::intermediateFunction() );
32 public function testN() {
33 $this->assertEquals( 'WfGetCallerTest->testN', self::intermediateFunction( 2, 0 ) );
34 $this->assertEquals(
35 'WfGetCallerTest::intermediateFunction',
36 self::intermediateFunction( 1, 0 )
39 for ( $i = 0; $i < 10; $i++ ) {
40 $this->assertEquals(
41 'WfGetCallerTest::intermediateFunction',
42 self::intermediateFunction( $i + 1, $i )