1
0
mirror of https://github.com/php/php-src.git synced 2026-04-17 21:11:02 +02:00
Files
archived-php-src/ext/spl/tests/recursive_tree_iterator_008.phpt
Fabien Villepinte a555cc0b3d Clean DONE tags from tests
Remove most of the `===DONE===` tags and its variations.
Keep `===DONE===` if the test output otherwise becomes empty.

Closes GH-4872.
2019-11-07 21:31:47 +01:00

40 lines
728 B
PHP

--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";
}
?>
--EXPECT--
[a] => 035Array
[0] => 0145b
[c] => 045Array
[0] => 0245d
OutOfRangeException thrown
OutOfRangeException thrown