diff options
Diffstat (limited to 'Zend/tests/catch_002.phpt')
-rw-r--r-- | Zend/tests/catch_002.phpt | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Zend/tests/catch_002.phpt b/Zend/tests/catch_002.phpt new file mode 100644 index 0000000..11d736a --- /dev/null +++ b/Zend/tests/catch_002.phpt @@ -0,0 +1,33 @@ +--TEST-- +Catching an exception in a constructor +--FILE-- +<?php + +class MyObject +{ + function __construct() + { + throw new Exception(); + echo __METHOD__ . "() Must not be reached\n"; + } + + function __destruct() + { + echo __METHOD__ . "() Must not be called\n"; + } +} + +try +{ + new MyObject(); +} +catch(Exception $e) +{ + echo "Caught\n"; +} + +?> +===DONE=== +--EXPECT-- +Caught +===DONE=== |