Code convensions: Class names should be UpperCamelCase. And for PHPUnit: Class name should end in 'Test'. Class name should match file name. Also made headers and spacing a bit more consistent. Change-Id: Id7b6cec7e552240de44386b4759b57c2d37a39d1
35 lines
924 B
PHP
35 lines
924 B
PHP
<?php
|
|
|
|
class WfGetCallerTest extends MediaWikiTestCase {
|
|
|
|
function testZero() {
|
|
$this->assertEquals( __METHOD__, wfGetCaller( 1 ) );
|
|
}
|
|
|
|
function callerOne() {
|
|
return wfGetCaller();
|
|
}
|
|
|
|
function testOne() {
|
|
$this->assertEquals( 'WfGetCallerTest::testOne', self::callerOne() );
|
|
}
|
|
|
|
function intermediateFunction( $level = 2, $n = 0 ) {
|
|
if ( $n > 0 ) {
|
|
return self::intermediateFunction( $level, $n - 1 );
|
|
}
|
|
return wfGetCaller( $level );
|
|
}
|
|
|
|
function testTwo() {
|
|
$this->assertEquals( 'WfGetCallerTest::testTwo', self::intermediateFunction() );
|
|
}
|
|
|
|
function testN() {
|
|
$this->assertEquals( 'WfGetCallerTest::testN', self::intermediateFunction( 2, 0 ) );
|
|
$this->assertEquals( 'WfGetCallerTest::intermediateFunction', self::intermediateFunction( 1, 0 ) );
|
|
|
|
for ( $i = 0; $i < 10; $i++ )
|
|
$this->assertEquals( 'WfGetCallerTest::intermediateFunction', self::intermediateFunction( $i + 1, $i ) );
|
|
}
|
|
}
|