xref: /PHP-5.4/ext/spl/tests/iterator_020.phpt (revision 610c7fbe)
1--TEST--
2SPL: AppendIterator
3--FILE--
4<?php
5
6echo "===Empty===\n";
7
8$it = new AppendIterator;
9
10foreach($it as $key=>$val)
11{
12	echo "$key=>$val\n";
13}
14
15echo "===Append===\n";
16
17$it->append(new ArrayIterator(array(0 => 'A', 1 => 'B')));
18
19foreach($it as $key=>$val)
20{
21	echo "$key=>$val\n";
22}
23
24echo "===Rewind===\n";
25
26foreach($it as $key=>$val)
27{
28	echo "$key=>$val\n";
29}
30
31echo "===Append===\n";
32
33$it->append(new ArrayIterator(array(2 => 'C', 3 => 'D')));
34
35foreach(new NoRewindIterator($it) as $key=>$val)
36{
37	echo "$key=>$val\n";
38}
39
40echo "===Rewind===\n";
41
42foreach($it as $key=>$val)
43{
44	echo "$key=>$val\n";
45}
46
47?>
48===DONE===
49<?php exit(0); ?>
50--EXPECTF--
51===Empty===
52===Append===
530=>A
541=>B
55===Rewind===
560=>A
571=>B
58===Append===
592=>C
603=>D
61===Rewind===
620=>A
631=>B
642=>C
653=>D
66===DONE===
67