com php-src: improve test coverage of multicatch: Zend/tests/try/exceptions.inc Zend/tests/try/try_multicatch _006.phpt
Zend/tests/try/try_multicatch_00 7.phpt
| From: | Joe Watkins | Date: | Mon, 02 May 2016 17:48:50 +0000 |
| Subject: | com php-src: improve test coverage of multicatch: Zend/tests/try/exceptions.inc Zend/tests/try/try_multicatch _006.phpt Zend/tests/try/try_multicatch_00 7.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92000@lists.php.net to get a copy of this message | ||
Commit: 5e10735d07578fcf656e40d0a967a9bc557ad838
Author: Joe Watkins <krakjoe@php.net> Mon, 2 May 2016 18:48:50 +0100
Parents: eb72b0ee06033f3ac05ee5027e4a4aee5049b0be
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5e10735d07578fcf656e40d0a967a9bc557ad838
Log:
improve test coverage of multicatch
Changed paths:
M Zend/tests/try/exceptions.inc
A Zend/tests/try/try_multicatch_006.phpt
A Zend/tests/try/try_multicatch_007.phpt
Diff:
diff --git a/Zend/tests/try/exceptions.inc b/Zend/tests/try/exceptions.inc
index 8a87779..68cb1c6 100644
--- a/Zend/tests/try/exceptions.inc
+++ b/Zend/tests/try/exceptions.inc
@@ -3,3 +3,4 @@
class Exception1 extends Exception {}
class Exception2 extends Exception {}
class Exception3 extends Exception {}
+class Exception4 extends Exception {}
diff --git a/Zend/tests/try/try_multicatch_006.phpt b/Zend/tests/try/try_multicatch_006.phpt
new file mode 100644
index 0000000..e4505f1
--- /dev/null
+++ b/Zend/tests/try/try_multicatch_006.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Catch first exception in the second multicatch
+--FILE--
+<?php
+require_once __DIR__ . '/exceptions.inc';
+
+try {
+ echo 'TRY' . PHP_EOL;
+ throw new Exception3;
+} catch(Exception1 | Exception2 $e) {
+ echo get_class($e) . PHP_EOL;
+} catch(Exception3 | Exception4 $e) {
+ echo get_class($e) . PHP_EOL;
+} finally {
+ echo 'FINALLY' . PHP_EOL;
+}
+?>
+--EXPECT--
+TRY
+Exception3
+FINALLY
+
diff --git a/Zend/tests/try/try_multicatch_007.phpt b/Zend/tests/try/try_multicatch_007.phpt
new file mode 100644
index 0000000..aa073b0
--- /dev/null
+++ b/Zend/tests/try/try_multicatch_007.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Catch second exception in the second multicatch
+--FILE--
+<?php
+require_once __DIR__ . '/exceptions.inc';
+
+try {
+ echo 'TRY' . PHP_EOL;
+ throw new Exception4;
+} catch(Exception1 | Exception2 $e) {
+ echo get_class($e) . PHP_EOL;
+} catch(Exception3 | Exception4 $e) {
+ echo get_class($e) . PHP_EOL;
+} finally {
+ echo 'FINALLY' . PHP_EOL;
+}
+?>
+--EXPECT--
+TRY
+Exception4
+FINALLY
+