Use the frame 'type' in wfFormatStackFrame, like MWExceptionHandler::prettyPrintTrace
authorAlex Monk <krenair@gmail.com>
Fri, 9 Oct 2015 17:20:25 +0000 (18:20 +0100)
committerAlex Monk <krenair@gmail.com>
Wed, 14 Oct 2015 15:40:02 +0000 (16:40 +0100)
Instead of assuming '::'

Change-Id: I2452bc5ebd3716eb61f53da41a0050f4833fb5a4

includes/GlobalFunctions.php
tests/phpunit/includes/GlobalFunctions/wfGetCallerTest.php
tests/phpunit/includes/debug/MWDebugTest.php

index 8fa42e9..8f2d43b 100644 (file)
@@ -1988,8 +1988,8 @@ function wfFormatStackFrame( $frame ) {
        if ( !isset( $frame['function'] ) ) {
                return 'NO_FUNCTION_GIVEN';
        }
-       return isset( $frame['class'] ) ?
-               $frame['class'] . '::' . $frame['function'] :
+       return isset( $frame['class'] ) && isset( $frame['type'] ) ?
+               $frame['class'] . $frame['type'] . $frame['function'] :
                $frame['function'];
 }
 
index bb2b33f..8a7bfa5 100644 (file)
@@ -6,7 +6,7 @@
  */
 class WfGetCallerTest extends MediaWikiTestCase {
        public function testZero() {
-               $this->assertEquals( __METHOD__, wfGetCaller( 1 ) );
+               $this->assertEquals( 'WfGetCallerTest->testZero', wfGetCaller( 1 ) );
        }
 
        function callerOne() {
@@ -14,10 +14,10 @@ class WfGetCallerTest extends MediaWikiTestCase {
        }
 
        public function testOne() {
-               $this->assertEquals( 'WfGetCallerTest::testOne', self::callerOne() );
+               $this->assertEquals( 'WfGetCallerTest->testOne', self::callerOne() );
        }
 
-       function intermediateFunction( $level = 2, $n = 0 ) {
+       static function intermediateFunction( $level = 2, $n = 0 ) {
                if ( $n > 0 ) {
                        return self::intermediateFunction( $level, $n - 1 );
                }
@@ -26,11 +26,11 @@ class WfGetCallerTest extends MediaWikiTestCase {
        }
 
        public function testTwo() {
-               $this->assertEquals( 'WfGetCallerTest::testTwo', self::intermediateFunction() );
+               $this->assertEquals( 'WfGetCallerTest->testTwo', self::intermediateFunction() );
        }
 
        public function testN() {
-               $this->assertEquals( 'WfGetCallerTest::testN', self::intermediateFunction( 2, 0 ) );
+               $this->assertEquals( 'WfGetCallerTest->testN', self::intermediateFunction( 2, 0 ) );
                $this->assertEquals(
                        'WfGetCallerTest::intermediateFunction',
                        self::intermediateFunction( 1, 0 )
index 7280a97..3497c88 100644 (file)
@@ -29,7 +29,7 @@ class MWDebugTest extends MediaWikiTestCase {
                        array( array(
                                'msg' => 'logging a string',
                                'type' => 'log',
-                               'caller' => __METHOD__,
+                               'caller' => 'MWDebugTest->testAddLog',
                        ) ),
                        MWDebug::getLog()
                );