php-src/ext/spl/tests/recursive_tree_iterator_007.phpt
Gabriel Caruso ded3d984c6 Use EXPECT instead of EXPECTF when possible
EXPECTF logic in run-tests.php is considerable, so let's avoid it.
2018-02-20 21:53:48 +01:00

34 lines
656 B
PHP

--TEST--
SPL: RecursiveTreeIterator and Exception from getEntry()
--INI--
error_reporting=E_ALL&~E_NOTICE
--FILE--
<?php
$ary = array(new stdClass);
class RecursiveArrayIteratorAggregated implements IteratorAggregate {
public $it;
function __construct($it) {
$this->it = new RecursiveArrayIterator($it);
}
function getIterator() {
return $this->it;
}
}
$it = new RecursiveArrayIteratorAggregated($ary);
try {
foreach(new RecursiveTreeIterator($it) as $k => $v) {
echo "[$k] => $v\n";
}
} catch (UnexpectedValueException $e) {
echo "UnexpectedValueException thrown\n";
}
?>
===DONE===
--EXPECT--
UnexpectedValueException thrown
===DONE===