SimpleStackTrace::traceMethod PHP 메소드

traceMethod() 공개 메소드

Captures a stack trace if none given.
public traceMethod ( array $stack = false ) : string
$stack array List of stack frames.
리턴 string Snippet of test report with line number and file.
    public function traceMethod($stack = false)
    {
        $stack = $stack ? $stack : $this->captureTrace();
        foreach ($stack as $frame) {
            if ($this->frameLiesWithinSimpleTestFolder($frame)) {
                continue;
            }
            if ($this->frameMatchesPrefix($frame)) {
                return ' at [' . $frame['file'] . ' line ' . $frame['line'] . ']';
            }
        }
        return '';
    }

Usage Example

예제 #1
0
 /**
  *    Uses a stack trace to find the line of an assertion.
  *    @access public
  *    @static
  */
 function getExpectationLine()
 {
     $trace = new SimpleStackTrace(array('expect'));
     return $trace->traceMethod();
 }
All Usage Examples Of SimpleStackTrace::traceMethod