4 require "director_exception.php";
7 check::functions(array(foo_ping,foo_pong,launder,bar_ping,bar_pong,bar_pang));
9 check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar));
11 check::globals(array());
13 class MyException extends Exception {
14 function __construct($a, $b) {
19 class MyFoo extends Foo {
21 throw new Exception("MyFoo::ping() EXCEPTION");
25 class MyFoo2 extends Foo {
31 class MyFoo3 extends Foo {
33 throw new MyException("foo", "bar");
37 # Check that the Exception raised by MyFoo.ping() is returned by
41 # TODO: Currently we do not track the dynamic type of returned
42 # objects, so we skip the launder() call.
43 #$b = director_exception::launder($a);
47 } catch (Exception $e) {
49 check::equal($e->getMessage(), "MyFoo::ping() EXCEPTION", "Unexpected error message #1");
51 check::equal($ok, 1, "Got no exception while expected one #1");
53 # Check that the director can return an exception which requires two
54 # arguments to the constructor, without mangling it.
57 #$b = director_exception::launder($a);
61 } catch (Exception $e) {
63 check::equal($e->msg, "foobar", "Unexpected error message #2");
65 check::equal($ok, 1, "Got no exception while expected one #2");
68 throw new Exception2();
69 } catch (Exception2 $e2) {
73 throw new Exception1();
74 } catch (Exception1 $e1) {