Skip to content

Commit

Permalink
Making CakeHtmlReporter dump a stack trace when an exception is caught.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 28, 2010
1 parent 81f6f43 commit 2f1aa0a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cake/tests/lib/reporter/cake_html_reporter.php
Expand Up @@ -265,14 +265,16 @@ public function paintPass(PHPUnit_Framework_Test $test, $time = null) {
* @param Exception $exception Exception to display.
* @return void
*/
public function paintException($exception, $test) {
public function paintException($message, $test) {
$trace = $this->_getStackTrace($message);
$testName = get_class($test) . '(' . $test->getName() . ')';

echo "<li class='fail'>\n";
echo "<span>Exception</span>";
$message = 'Unexpected exception of type [' . get_class($exception) .
'] with message ['. $exception->getMessage() .
'] in ['. $exception->getFile() .
' line ' . $exception->getLine() . ']';
echo "<div class='msg'>" . $this->_htmlEntities($message) . "</div>\n";

echo "<div class='msg'>" . $this->_htmlEntities($message->getMessage()) . "</div>\n";
echo "<div class='msg'>" . sprintf(__('Test case: %s'), $testName) . "</div>\n";
echo "<div class='msg'>" . __('Stack trace:') . '<br />' . $trace . "</div>\n";
echo "</li>\n";
}

Expand Down

0 comments on commit 2f1aa0a

Please sign in to comment.