Annotation of embedaddon/php/ext/spl/tests/recursiveiteratoriterator_enditeration_basic.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: RecursiveIteratorIterator::endIteration() is called when ::valid() first returns false
3: --CREDITS--
4: Matt Raines matt@raines.me.uk
5: #testfest London 2009-05-09
6: --FILE--
7: <?php
8: $sample_array = array(1, 2);
9: $sub_iterator = new RecursiveArrayIterator($sample_array);
10:
11: $iterator = new RecursiveIteratorIterator($sub_iterator);
12: foreach ($iterator as $element) {
13: var_dump($element);
14: }
15:
16: class EndIterationRecursiveIteratorIterator extends RecursiveIteratorIterator {
17: public function endIteration() {
18: echo "::endIteration() was invoked\n";
19: }
20: }
21: $iterator = new EndIterationRecursiveIteratorIterator($sub_iterator);
22: foreach ($iterator as $element) {
23: var_dump($element);
24: }
25: ?>
26: --EXPECT--
27: int(1)
28: int(2)
29: int(1)
30: int(2)
31: ::endIteration() was invoked
32:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>