|
From: tarjei <ta...@nu...> - 2009-01-12 16:16:38
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi, here's a quick patch to add the ability for TextReporter to print
out a stacktrace of an exception in one of the tests.
I didn't find ut where to write the test (didn't look to closely), but
would appreciate it if someone could advise me on that point.
Usage:
The printStackTrace variable can be set if you want simpletest to print
stacktraces as well as the normal message.
kind regards,
Tarjei
Index: reporter.php
===================================================================
- --- reporter.php (revision 3994)
+++ reporter.php (working copy)
@@ -203,6 +203,9 @@
$this->SimpleReporter();
}
+ public $printStackTrace = false;
+
+
/**
* Paints the title only.
* @param string $test_name Name class of test.
@@ -278,6 +281,9 @@
'] in ['. $exception->getFile() .
' line ' . $exception->getLine() . ']';
print "Exception " . $this->getExceptionCount() . "!\n$message\n";
+ if ($this->printStackTrace ){
+ print $exception->getTraceAsString() . "\n";
+ }
$breadcrumb = $this->getTestList();
array_shift($breadcrumb);
print "\tin " . implode("\n\tin ", array_reverse($breadcrumb));
@@ -444,4 +450,4 @@
*/
function paintSkip($message) { }
}
- -?>
\ No newline at end of file
+?>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFJa2gJYVRKCnSvzfIRAgKgAKCqNDY50QI/nnDJQRlpmnRyKYOIEgCgtS/K
QM36pwCNGVpYSjoB6QAvfvk=
=mX5d
-----END PGP SIGNATURE-----
|