Annotation of embedaddon/php/ext/spl/tests/iterator_032.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: LimitIterator::getPosition()
3: --FILE--
4: <?php
5:
6: $it = new LimitIterator(new ArrayIterator(array(1,2,3,4)), 1, 2);
7:
8: foreach($it as $k=>$v)
9: {
10: echo "$k=>$v\n";
11: var_dump($it->getPosition());
12: }
13:
14: try
15: {
16: $it->seek(0);
17: }
18: catch(OutOfBoundsException $e)
19: {
20: echo $e->getMessage() . "\n";
21: }
22:
23: $it->seek(2);
24: var_dump($it->current());
25:
26: try
27: {
28: $it->seek(3);
29: }
30: catch(OutOfBoundsException $e)
31: {
32: echo $e->getMessage() . "\n";
33: }
34:
35: $it->next();
36: var_dump($it->valid());
37:
38: ?>
39: ===DONE===
40: <?php exit(0); ?>
41: --EXPECT--
42: 1=>2
43: int(1)
44: 2=>3
45: int(2)
46: Cannot seek to 0 which is below the offset 1
47: int(3)
48: Cannot seek to 3 which is behind offset 1 plus count 2
49: bool(false)
50: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>