From 5f0f6b7c843596a05fb311e4636959ea71e7aaac Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 5 Feb 2015 21:39:52 +0100 Subject: Improve error line information in Test-More This finds the last frame before Test-More instead of using the topmost frame. Signed-off-by: Florian Pritz --- application/third_party/test-more-php/Test-Simple-OO.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'application/third_party') diff --git a/application/third_party/test-more-php/Test-Simple-OO.php b/application/third_party/test-more-php/Test-Simple-OO.php index 1d33eff2e..9bbe4aada 100755 --- a/application/third_party/test-more-php/Test-Simple-OO.php +++ b/application/third_party/test-more-php/Test-Simple-OO.php @@ -154,10 +154,14 @@ class TestSimple { } else { echo $this->LastFail = "not ok $title\n"; - $stack = isset($this->Backtrace) ? $this->Backtrace : debug_backtrace(); - $call = array_pop($stack); - $file = basename($call['file']); - $line = $call['line']; + $stack = isset($this->Backtrace) ? $this->Backtrace : debug_backtrace(); + foreach (array_reverse($stack) as $frame) { + if (isset($frame["object"]) && $frame["object"] == $this) { + $file = $frame["file"]; + $line = $frame["line"]; + break; + } + } unset($this->Backtrace); if ($caption) { -- cgit v1.2.3-24-g4f1b