Annotation of embedaddon/php/ext/spl/tests/recursive_tree_iterator_008.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: SPL: RecursiveTreeIterator::setPrefixPart()
3: --INI--
4: error_reporting=E_ALL&~E_NOTICE
5: --FILE--
6: <?php
7:
8: $ary = array(
9: "a" => array("b"),
10: "c" => array("d"),
11: );
12:
13: $it = new RecursiveArrayIterator($ary);
14: $it = new RecursiveTreeIterator($it);
15: for($i = 0; $i < 6; ++$i) {
16: $it->setPrefixPart($i, $i);
17: }
18: foreach($it as $k => $v) {
19: echo "[$k] => $v\n";
20: }
21: try {
22: $it->setPrefixPart(-1, "");
23: $it->setPrefixPart(6, "");
24: } catch (OutOfRangeException $e) {
25: echo "OutOfRangeException thrown\n";
26: }
27: try {
28: $it->setPrefixPart(6, "");
29: } catch (OutOfRangeException $e) {
30: echo "OutOfRangeException thrown\n";
31: }
32: ?>
33: ===DONE===
34: --EXPECTF--
35: [a] => 035Array
36: [0] => 0145b
37: [c] => 045Array
38: [0] => 0245d
39: OutOfRangeException thrown
40: OutOfRangeException thrown
41: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>