Annotation of embedaddon/php/ext/spl/tests/iterator_005.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SPL: IteratorIterator and ArrayIterator/Object
! 3: --FILE--
! 4: <?php
! 5:
! 6: class ArrayIteratorEx extends ArrayIterator
! 7: {
! 8: function rewind()
! 9: {
! 10: echo __METHOD__ . "\n";
! 11: return parent::rewind();
! 12: }
! 13: }
! 14:
! 15: $it = new ArrayIteratorEx(range(0,3));
! 16:
! 17: foreach(new IteratorIterator($it) as $v)
! 18: {
! 19: var_dump($v);
! 20: }
! 21:
! 22: class ArrayObjectEx extends ArrayObject
! 23: {
! 24: function getIterator()
! 25: {
! 26: echo __METHOD__ . "\n";
! 27: return parent::getIterator();
! 28: }
! 29: }
! 30:
! 31: $it = new ArrayObjectEx(range(0,3));
! 32:
! 33: foreach(new IteratorIterator($it) as $v)
! 34: {
! 35: var_dump($v);
! 36: }
! 37:
! 38: ?>
! 39: ===DONE===
! 40: <?php exit(0); ?>
! 41: --EXPECTF--
! 42: ArrayIteratorEx::rewind
! 43: int(0)
! 44: int(1)
! 45: int(2)
! 46: int(3)
! 47: ArrayObjectEx::getIterator
! 48: int(0)
! 49: int(1)
! 50: int(2)
! 51: int(3)
! 52: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>