xref: /PHP-5.4/ext/spl/tests/iterator_011.phpt (revision 610c7fbe)
1--TEST--
2SPL: InfiniteIterator
3--FILE--
4<?php
5
6echo "===EmptyIterator===\n";
7
8foreach(new LimitIterator(new InfiniteIterator(new EmptyIterator()), 0, 3) as $key=>$val)
9{
10	echo "$key=>$val\n";
11}
12
13echo "===InfiniteIterator===\n";
14
15$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D'));
16$it = new InfiniteIterator($it);
17$it = new LimitIterator($it, 2, 5);
18foreach($it as $val=>$key)
19{
20	echo "$val=>$key\n";
21}
22
23echo "===Infinite/LimitIterator===\n";
24
25$it = new ArrayIterator(array(0 => 'A', 1 => 'B', 2 => 'C', 3 => 'D'));
26$it = new LimitIterator($it, 1, 2);
27$it = new InfiniteIterator($it);
28$it = new LimitIterator($it, 2, 5);
29foreach($it as $val=>$key)
30{
31	echo "$val=>$key\n";
32}
33
34?>
35===DONE===
36<?php exit(0); ?>
37--EXPECTF--
38===EmptyIterator===
39===InfiniteIterator===
402=>C
413=>D
420=>A
431=>B
442=>C
45===Infinite/LimitIterator===
461=>B
472=>C
481=>B
492=>C
501=>B
51===DONE===
52