iterator_030.phpt 587 B

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