Annotation of embedaddon/php/tests/classes/array_access_013.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: ZE2 ArrayAccess and exceptions
! 3: --FILE--
! 4: <?php
! 5:
! 6: class Test implements ArrayAccess
! 7: {
! 8: public function offsetExists($offset) { throw new Exception(__METHOD__); return false; }
! 9: public function offsetGet($offset) { throw new Exception(__METHOD__); return $offset; }
! 10: public function offsetSet($offset, $data ) { throw new Exception(__METHOD__); }
! 11: public function offsetUnset($offset) { throw new Exception(__METHOD__); }
! 12: }
! 13:
! 14: $t = new Test;
! 15:
! 16: try
! 17: {
! 18: echo isset($t[0]);
! 19: }
! 20: catch(Exception $e)
! 21: {
! 22: echo "Caught in " . $e->getMessage() . "()\n";
! 23: }
! 24:
! 25: try
! 26: {
! 27: echo $t[0];
! 28: }
! 29: catch(Exception $e)
! 30: {
! 31: echo "Caught in " . $e->getMessage() . "()\n";
! 32: }
! 33:
! 34: try
! 35: {
! 36: $t[0] = 1;
! 37: }
! 38: catch(Exception $e)
! 39: {
! 40: echo "Caught in " . $e->getMessage() . "()\n";
! 41: }
! 42:
! 43: try
! 44: {
! 45: unset($t[0]);
! 46: }
! 47: catch(Exception $e)
! 48: {
! 49: echo "Caught in " . $e->getMessage() . "()\n";
! 50: }
! 51: ?>
! 52: ===DONE===
! 53: --EXPECT--
! 54: Caught in Test::offsetExists()
! 55: Caught in Test::offsetGet()
! 56: Caught in Test::offsetSet()
! 57: Caught in Test::offsetUnset()
! 58: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>