From 2f1aa0a97fda197fca81308871ec20ba7f5e6418 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 26 Jul 2010 22:36:34 -0400 Subject: [PATCH] Making CakeHtmlReporter dump a stack trace when an exception is caught. --- cake/tests/lib/reporter/cake_html_reporter.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cake/tests/lib/reporter/cake_html_reporter.php b/cake/tests/lib/reporter/cake_html_reporter.php index 4252c4ccca7..fd2b4c80b9d 100755 --- a/cake/tests/lib/reporter/cake_html_reporter.php +++ b/cake/tests/lib/reporter/cake_html_reporter.php @@ -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 "
  • \n"; echo "Exception"; - $message = 'Unexpected exception of type [' . get_class($exception) . - '] with message ['. $exception->getMessage() . - '] in ['. $exception->getFile() . - ' line ' . $exception->getLine() . ']'; - echo "
    " . $this->_htmlEntities($message) . "
    \n"; + + echo "
    " . $this->_htmlEntities($message->getMessage()) . "
    \n"; + echo "
    " . sprintf(__('Test case: %s'), $testName) . "
    \n"; + echo "
    " . __('Stack trace:') . '
    ' . $trace . "
    \n"; echo "
  • \n"; }