xref: /PHP-7.4/ext/spl/tests/iterator_030.phpt (revision 610c7fbe)
1--TEST--
2SPL: EmptyIterator access
3--FILE--
4<?php
5
6$it = new EmptyIterator;
7
8var_dump($it->valid());
9$it->rewind();
10var_dump($it->valid());
11$it->next();
12var_dump($it->valid());
13
14try
15{
16	var_dump($it->key());
17}
18catch(BadMethodCallException $e)
19{
20	echo $e->getMessage() . "\n";
21}
22
23try
24{
25	var_dump($it->current());
26}
27catch(BadMethodCallException $e)
28{
29	echo $e->getMessage() . "\n";
30}
31
32var_dump($it->valid());
33
34?>
35===DONE===
36<?php exit(0); ?>
37--EXPECT--
38bool(false)
39bool(false)
40bool(false)
41Accessing the key of an EmptyIterator
42Accessing the value of an EmptyIterator
43bool(false)
44===DONE===
45