diff options
Diffstat (limited to 'ext/spl/tests/recursive_tree_iterator_008.phpt')
-rwxr-xr-x | ext/spl/tests/recursive_tree_iterator_008.phpt | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/ext/spl/tests/recursive_tree_iterator_008.phpt b/ext/spl/tests/recursive_tree_iterator_008.phpt new file mode 100755 index 0000000000..a0349800fb --- /dev/null +++ b/ext/spl/tests/recursive_tree_iterator_008.phpt @@ -0,0 +1,41 @@ +--TEST-- +SPL: RecursiveTreeIterator::setPrefixPart() +--INI-- +error_reporting=E_ALL&~E_NOTICE +--FILE-- +<?php + +$ary = array( + "a" => array("b"), + "c" => array("d"), +); + +$it = new RecursiveArrayIterator($ary); +$it = new RecursiveTreeIterator($it); +for($i = 0; $i < 6; ++$i) { + $it->setPrefixPart($i, $i); +} +foreach($it as $k => $v) { + echo "[$k] => $v\n"; +} +try { + $it->setPrefixPart(-1, ""); + $it->setPrefixPart(6, ""); +} catch (OutOfRangeException $e) { + echo "OutOfRangeException thrown\n"; +} +try { + $it->setPrefixPart(6, ""); +} catch (OutOfRangeException $e) { + echo "OutOfRangeException thrown\n"; +} +?> +===DONE=== +--EXPECTF-- +[a] => 035Array +[0] => 0145b +[c] => 045Array +[0] => 0245d +OutOfRangeException thrown +OutOfRangeException thrown +===DONE=== |