summaryrefslogtreecommitdiff
path: root/Zend/tests/generators/throw_caught.phpt
blob: 0c3f8e9b2daaefbbe3141ddbbe53c5699d762a74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--TEST--
Generator::throw() where the exception is caught in the generator
--FILE--
<?php

function gen() {
    try {
        yield;
    } catch (RuntimeException $e) {
        echo $e, "\n\n";
    }

    yield 'result';
}

$gen = gen();
var_dump($gen->throw(new RuntimeException('Test')));

?>
--EXPECTF--
exception 'RuntimeException' with message 'Test' in %s:%d
Stack trace:
#0 {main}

string(6) "result"