Annotation of embedaddon/php/ext/oci8/tests/coll_018.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Collection trim tests
! 3: --SKIPIF--
! 4: <?php
! 5: $target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs
! 6: require(dirname(__FILE__).'/skipif.inc');
! 7: ?>
! 8: --FILE--
! 9: <?php
! 10:
! 11: require dirname(__FILE__)."/connect.inc";
! 12: require dirname(__FILE__)."/create_type.inc";
! 13:
! 14: $coll1 = oci_new_collection($c, $type_name);
! 15:
! 16: echo "Test 1.\n";
! 17: var_dump($coll1->trim());
! 18:
! 19: echo "\nTest 2.\n";
! 20: var_dump($coll1->trim(0));
! 21:
! 22: echo "\nTest 3.\n";
! 23: var_dump($coll1->append(1));
! 24: var_dump($coll1->append(2));
! 25: var_dump($coll1->append(3));
! 26: var_dump($coll1->append(4));
! 27:
! 28: var_dump($coll1->getElem(-1)); // check before the beginning
! 29: var_dump($coll1->getElem(0));
! 30: var_dump($coll1->getElem(1));
! 31: var_dump($coll1->getElem(2));
! 32: var_dump($coll1->getElem(3));
! 33: var_dump($coll1->getElem(4)); // check past the end
! 34:
! 35: echo "\nTest 4.\n";
! 36: var_dump($coll1->trim(1));
! 37: var_dump($coll1->getElem(2)); // this should be the last element
! 38: var_dump($coll1->getElem(3)); // this element should have gone
! 39:
! 40: echo "\nTest 5.\n";
! 41: var_dump($coll1->trim(2));
! 42: var_dump($coll1->getElem(0)); // this should be the last element
! 43: var_dump($coll1->getElem(1)); // this element should have gone
! 44:
! 45: echo "\nTest 6.\n";
! 46: var_dump($coll1->trim(0));
! 47: var_dump($coll1->getElem(0)); // this should still be the last element
! 48:
! 49: echo "\nTest 7.\n";
! 50: var_dump($coll1->trim(1));
! 51: var_dump($coll1->getElem(0)); // this should have gone
! 52:
! 53: echo "Done\n";
! 54:
! 55: require dirname(__FILE__)."/drop_type.inc";
! 56:
! 57: ?>
! 58: --EXPECTF--
! 59: Test 1.
! 60:
! 61: Warning: OCI-Collection::trim() expects exactly 1 parameter, 0 given in %s on line 9
! 62: NULL
! 63:
! 64: Test 2.
! 65: bool(true)
! 66:
! 67: Test 3.
! 68: bool(true)
! 69: bool(true)
! 70: bool(true)
! 71: bool(true)
! 72: bool(false)
! 73: float(1)
! 74: float(2)
! 75: float(3)
! 76: float(4)
! 77: bool(false)
! 78:
! 79: Test 4.
! 80: bool(true)
! 81: float(3)
! 82: bool(false)
! 83:
! 84: Test 5.
! 85: bool(true)
! 86: float(1)
! 87: bool(false)
! 88:
! 89: Test 6.
! 90: bool(true)
! 91: float(1)
! 92:
! 93: Test 7.
! 94: bool(true)
! 95: bool(false)
! 96: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>