1--TEST--
2Observer: Basic generator observability
3--SKIPIF--
4<?php if (!extension_loaded('zend-test')) die('skip: zend-test extension required'); ?>
5--INI--
6zend_test.observer.enabled=1
7zend_test.observer.observe_all=1
8zend_test.observer.show_return_value=1
9--FILE--
10<?php
11function getResults() {
12    for ($i = 10; $i < 13; $i++) {
13        yield $i;
14    }
15}
16
17function doSomething() {
18    $generator = getResults();
19    foreach ($generator as $value) {
20        echo $value . PHP_EOL;
21    }
22
23    return 'Done';
24}
25
26echo doSomething() . PHP_EOL;
27?>
28--EXPECTF--
29<!-- init '%s%eobserver_generator_%d.php' -->
30<file '%s%eobserver_generator_%d.php'>
31  <!-- init doSomething() -->
32  <doSomething>
33    <!-- init getResults() -->
34    <getResults>
35    </getResults:10>
3610
37    <getResults>
38    </getResults:11>
3911
40    <getResults>
41    </getResults:12>
4212
43    <getResults>
44    </getResults:NULL>
45  </doSomething:'Done'>
46Done
47</file '%s%eobserver_generator_%d.php'>
48