array_021.phpt 373 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. SPL: ArrayObject::seek() and exceptions
  3. --FILE--
  4. <?php
  5. class foo extends ArrayObject
  6. {
  7. public function seek($key)
  8. {
  9. echo __METHOD__ . "($key)\n";
  10. throw new Exception("hi");
  11. }
  12. }
  13. $test = new foo(array(1,2,3));
  14. try
  15. {
  16. $test->seek('bar');
  17. }
  18. catch (Exception $e)
  19. {
  20. echo "got exception\n";
  21. }
  22. ?>
  23. ===DONE===
  24. --EXPECT--
  25. foo::seek(bar)
  26. got exception
  27. ===DONE===