From: Marcus Boerger Date: Thu, 3 Mar 2005 10:48:02 +0000 (+0000) Subject: - Rename test 14 to 16 (which is a new one) and MFB 14 again X-Git-Tag: RELEASE_0_3~91 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d9145daa61fa264d7223023f2a760bbfab676e00;p=php - Rename test 14 to 16 (which is a new one) and MFB 14 again --- diff --git a/ext/spl/tests/array_014.phpt b/ext/spl/tests/array_014.phpt index d4ea0ab39a..8accd97dfc 100755 --- a/ext/spl/tests/array_014.phpt +++ b/ext/spl/tests/array_014.phpt @@ -1,21 +1,32 @@ --TEST-- -SPL: ArrayItaerator/Object and IteratorIterator +SPL: ArrayIterator::seek() --SKIPIF-- --FILE-- count()); +$it->seek(5); +var_dump($it->current()); +$it->seek(4); +var_dump($it->current()); +$it->seek(-1); +var_dump($it->current()); +try { - var_dump($v); + $it->seek(12); + var_dump($it->current()); +} +catch(Exception $e) +{ + echo $e->getMessage() . "\n"; } -$it = new ArrayObject(range(0,3)); - -foreach(new IteratorIterator($it) as $v) +$pos = 0; +foreach($it as $v) { + $it->seek($pos++); var_dump($v); } @@ -23,12 +34,20 @@ foreach(new IteratorIterator($it) as $v) ===DONE=== --EXPECTF-- +int(11) +int(5) +int(4) int(0) -int(1) -int(2) -int(3) +Seek position 12 is out of range int(0) int(1) int(2) int(3) +int(4) +int(5) +int(6) +int(7) +int(8) +int(9) +int(10) ===DONE=== diff --git a/ext/spl/tests/array_016.phpt b/ext/spl/tests/array_016.phpt new file mode 100755 index 0000000000..d4ea0ab39a --- /dev/null +++ b/ext/spl/tests/array_016.phpt @@ -0,0 +1,34 @@ +--TEST-- +SPL: ArrayItaerator/Object and IteratorIterator +--SKIPIF-- + +--FILE-- + +===DONE=== + +--EXPECTF-- +int(0) +int(1) +int(2) +int(3) +int(0) +int(1) +int(2) +int(3) +===DONE===