mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
improve test coverage of multicatch
This commit is contained in:
parent
eb72b0ee06
commit
5e10735d07
3 changed files with 45 additions and 0 deletions
|
@ -3,3 +3,4 @@
|
|||
class Exception1 extends Exception {}
|
||||
class Exception2 extends Exception {}
|
||||
class Exception3 extends Exception {}
|
||||
class Exception4 extends Exception {}
|
||||
|
|
22
Zend/tests/try/try_multicatch_006.phpt
Normal file
22
Zend/tests/try/try_multicatch_006.phpt
Normal file
|
@ -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
|
||||
|
22
Zend/tests/try/try_multicatch_007.phpt
Normal file
22
Zend/tests/try/try_multicatch_007.phpt
Normal file
|
@ -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
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue