Skip to content

Commit

Permalink
Merge pull request #86 from jesseschalken/master
Browse files Browse the repository at this point in the history
Include class names for class methods in stacktrace
  • Loading branch information
ConradIrwin committed May 29, 2015
2 parents f013ca9 + 73967b9 commit aa6ab28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
6 changes: 1 addition & 5 deletions src/Bugsnag/Stacktrace.php
Expand Up @@ -87,7 +87,7 @@ public function addFrame($file, $line, $method, $class = null)
// Construct the frame
$frame = array(
'lineNumber' => $line,
'method' => $method,
'method' => $class ? "$class::$method" : $method,
);

// Attach some lines of code for context
Expand All @@ -105,10 +105,6 @@ public function addFrame($file, $line, $method, $class = null)
$frame['file'] = preg_replace($this->config->stripPathRegex, '', $file);
}

if (!empty($class)) {
$frame['class'] = $class;
}

$this->frames[] = $frame;
}

Expand Down
16 changes: 8 additions & 8 deletions tests/Bugsnag/StacktraceTest.php
Expand Up @@ -86,9 +86,9 @@ public function testAnonymousFunctionStackframes()

$this->assertCount(5, $stacktrace);

$this->assertFrameEquals($stacktrace[0], "__callStatic", "somefile.php", 123);
$this->assertFrameEquals($stacktrace[1], "notifyError", "controllers/ExampleController.php", 12);
$this->assertFrameEquals($stacktrace[2], "index", "controllers/ExampleController.php", 12);
$this->assertFrameEquals($stacktrace[0], "Illuminate\\Support\\Facades\\Facade::__callStatic", "somefile.php", 123);
$this->assertFrameEquals($stacktrace[1], "Bugsnag\\BugsnagLaravel\\BugsnagFacade::notifyError", "controllers/ExampleController.php", 12);
$this->assertFrameEquals($stacktrace[2], "ExampleController::index", "controllers/ExampleController.php", 12);
$this->assertFrameEquals($stacktrace[3], "call_user_func_array", "[internal]", 0);
$this->assertFrameEquals($stacktrace[4], "[main]", "Routing/Controller.php", 194);
}
Expand All @@ -101,11 +101,11 @@ public function testXdebugErrorStackframes()
$this->assertCount(7, $stacktrace);

$this->assertFrameEquals($stacktrace[0], null, "somefile.php", 123);
$this->assertFrameEquals($stacktrace[1], "evaluatePath", "/View/Engines/PhpEngine.php", 39);
$this->assertFrameEquals($stacktrace[2], "get", "View/Engines/CompilerEngine.php", 57);
$this->assertFrameEquals($stacktrace[3], "getContents", "View/View.php", 136);
$this->assertFrameEquals($stacktrace[4], "renderContents", "View/View.php", 104);
$this->assertFrameEquals($stacktrace[5], "render", "View/View.php", 78);
$this->assertFrameEquals($stacktrace[1], "Illuminate\\View\\Engines\\PhpEngine::evaluatePath", "/View/Engines/PhpEngine.php", 39);
$this->assertFrameEquals($stacktrace[2], "Illuminate\\View\\Engines\\CompilerEngine::get", "View/Engines/CompilerEngine.php", 57);
$this->assertFrameEquals($stacktrace[3], "Illuminate\\View\\View::getContents", "View/View.php", 136);
$this->assertFrameEquals($stacktrace[4], "Illuminate\\View\\View::renderContents", "View/View.php", 104);
$this->assertFrameEquals($stacktrace[5], "Illuminate\\View\\View::render", "View/View.php", 78);
$this->assertFrameEquals($stacktrace[6], "[main]", "storage/views/f2df2d6b49591efeb36fc46e6dc25e0e", 5);
}

Expand Down

0 comments on commit aa6ab28

Please sign in to comment.