summaryrefslogtreecommitdiff
path: root/tests/test_tools/simpletest/exceptions.php
diff options
context:
space:
mode:
authorwei <>2006-07-07 23:18:19 +0000
committerwei <>2006-07-07 23:18:19 +0000
commitb2e97539e7af7712b04dd5c2610a454d09aa0333 (patch)
treed09ae76ddc7f349a39b74b0cb1f40c8b678a352e /tests/test_tools/simpletest/exceptions.php
parentfce10eed76455b7e0419f13affb4f29e73ef0375 (diff)
Update simpletest
Diffstat (limited to 'tests/test_tools/simpletest/exceptions.php')
-rw-r--r--tests/test_tools/simpletest/exceptions.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/test_tools/simpletest/exceptions.php b/tests/test_tools/simpletest/exceptions.php
new file mode 100644
index 00000000..949f2936
--- /dev/null
+++ b/tests/test_tools/simpletest/exceptions.php
@@ -0,0 +1,46 @@
+<?php
+ /**
+ * base include file for SimpleTest
+ * @package SimpleTest
+ * @subpackage UnitTester
+ * @version $Id: exceptions.php,v 1.1 2006/02/06 06:05:18 lastcraft Exp $
+ */
+
+ /**#@+
+ * Includes SimpleTest files and defined the root constant
+ * for dependent libraries.
+ */
+ require_once(dirname(__FILE__) . '/invoker.php');
+
+ /**
+ * Extension that traps exceptions and turns them into
+ * an error message.
+ * @package SimpleTest
+ * @subpackage UnitTester
+ */
+ class SimpleExceptionTrappingInvoker extends SimpleInvokerDecorator {
+
+ /**
+ * Stores the invoker to be wrapped.
+ * @param SimpleInvoker $invoker Test method runner.
+ */
+ function SimpleExceptionTrappingInvoker($invoker) {
+ $this->SimpleInvokerDecorator($invoker);
+ }
+
+ /**
+ * Invokes a test method and dispatches any
+ * untrapped errors.
+ * @param string $method Test method to call.
+ * @access public
+ */
+ function invoke($method) {
+ try {
+ parent::invoke($method);
+ } catch (Exception $exception) {
+ $test_case = $this->getTestCase();
+ $test_case->exception($exception);
+ }
+ }
+ }
+?> \ No newline at end of file