cvs: php4 /tests/lang 035.phpt
| From: | Marcus B�rger | Date: | Tue, 29 Oct 2002 13:51:44 +0000 |
| Subject: | cvs: php4 /tests/lang 035.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-15581@lists.php.net to get a copy of this message | ||
helly Tue Oct 29 08:51:44 2002 EDT
Modified files:
/php4/tests/lang 035.phpt
Log:
Rewrite: Taken from ZE2 RFC + a little textual modification
Index: php4/tests/lang/035.phpt
diff -u php4/tests/lang/035.phpt:1.2 php4/tests/lang/035.phpt:1.3
--- php4/tests/lang/035.phpt:1.2 Thu Aug 15 20:41:35 2002
+++ php4/tests/lang/035.phpt Tue Oct 29 08:51:44 2002
@@ -1,21 +1,38 @@
--TEST--
ZE2: set_exception_handler()
--SKIPIF--
-<?php if (version_compare(zend_version(), "2", "<")) print
"skip"; ?>
+<?php if (version_compare(zend_version(), "2.0.0-dev", "<")) print
"skip Zend engine 2 required"; ?>
--FILE--
<?php
+class MyException {
+ function MyException($_error) {
+ $this->error = $_error;
+ }
+
+ function getException()
+ {
+ return $this->error;
+ }
+}
-set_exception_handler("my_handler");
-try {
- throw new exception();
-} catch (stdClass $e) {
- print "BAR\n";
+function ThrowException()
+{
+ throw new MyException("'This is an exception!'");
}
-function my_handler($exception) {
- print "FOO\n";
+
+try {
+} catch (MyException $exception) {
+ print "There shouldn't be an exception: " . $exception->getException();
+ print "\n";
}
+try {
+ ThrowException();
+} catch (MyException $exception) {
+ print "There was an exception: " . $exception->getException();
+ print "\n";
+}
?>
--EXPECT--
-FOO
+There was an exception: 'This is an exception!'