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