Annotation of embedaddon/php/ext/spl/tests/dllist_006.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: SPL: DoublyLinkedList: ArrayAccess
! 3: --FILE--
! 4: <?php
! 5: $a = new SplDoublyLinkedList();
! 6: $a->push(1);
! 7: $a->push(2);
! 8: $a->push(3);
! 9:
! 10: $a[] = "foo";
! 11: $a[3] = 4;
! 12:
! 13: var_dump($a[0]);
! 14: var_dump($a[1]);
! 15: var_dump($a[2]);
! 16: var_dump($a[3]);
! 17:
! 18: echo "Unsetting..\n";
! 19: var_dump($a[2]);
! 20: unset($a[2]);
! 21: var_dump($a[2]);
! 22:
! 23:
! 24: try {
! 25: var_dump($a["1"]);
! 26: } catch (OutOfRangeException $e) {
! 27: echo "Exception: ".$e->getMessage()."\n";
! 28: }
! 29:
! 30: try {
! 31: var_dump($a["a"]);
! 32: } catch (OutOfRangeException $e) {
! 33: echo "Exception: ".$e->getMessage()."\n";
! 34: }
! 35:
! 36: try {
! 37: var_dump($a["0"]);
! 38: } catch (OutOfRangeException $e) {
! 39: echo "Exception: ".$e->getMessage()."\n";
! 40: }
! 41:
! 42: try {
! 43: var_dump($a["9"]);
! 44: } catch (OutOfRangeException $e) {
! 45: echo "Exception: ".$e->getMessage()."\n";
! 46: }
! 47: ?>
! 48: ===DONE===
! 49: <?php exit(0); ?>
! 50: --EXPECTF--
! 51: int(1)
! 52: int(2)
! 53: int(3)
! 54: int(4)
! 55: Unsetting..
! 56: int(3)
! 57: int(4)
! 58: int(2)
! 59: Exception: Offset invalid or out of range
! 60: int(1)
! 61: Exception: Offset invalid or out of range
! 62: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>