summaryrefslogtreecommitdiff
path: root/ext/oci8/tests/coll_018.phpt
blob: a3f0b29ce5c80fe3be23e87a4ab5c8721a5f85d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
--TEST--
Collection trim tests
--SKIPIF--
<?php
$target_dbs = array('oracledb' => true, 'timesten' => false);  // test runs on these DBs
require(dirname(__FILE__).'/skipif.inc');
?> 
--FILE--
<?php

require dirname(__FILE__)."/connect.inc";
require dirname(__FILE__)."/create_type.inc";

$coll1 = oci_new_collection($c, $type_name);

echo "Test 1.\n";
var_dump($coll1->trim());

echo "\nTest 2.\n";
var_dump($coll1->trim(0));

echo "\nTest 3.\n";
var_dump($coll1->append(1));
var_dump($coll1->append(2));
var_dump($coll1->append(3));
var_dump($coll1->append(4));

var_dump($coll1->getElem(-1));  // check before the beginning
var_dump($coll1->getElem(0));
var_dump($coll1->getElem(1));
var_dump($coll1->getElem(2));
var_dump($coll1->getElem(3));
var_dump($coll1->getElem(4));  // check past the end

echo "\nTest 4.\n";
var_dump($coll1->trim(1));
var_dump($coll1->getElem(2));  // this should be the last element
var_dump($coll1->getElem(3));  // this element should have gone

echo "\nTest 5.\n";
var_dump($coll1->trim(2));
var_dump($coll1->getElem(0));  // this should be the last element
var_dump($coll1->getElem(1));  // this element should have gone

echo "\nTest 6.\n";
var_dump($coll1->trim(0));
var_dump($coll1->getElem(0));  // this should still be the last element

echo "\nTest 7.\n";
var_dump($coll1->trim(1));
var_dump($coll1->getElem(0));  // this should have gone

echo "Done\n";

require dirname(__FILE__)."/drop_type.inc";

?>
--EXPECTF--
Test 1.

Warning: OCI-Collection::trim() expects exactly 1 parameter, 0 given in %s on line 9
NULL

Test 2.
bool(true)

Test 3.
bool(true)
bool(true)
bool(true)
bool(true)
bool(false)
float(1)
float(2)
float(3)
float(4)
bool(false)

Test 4.
bool(true)
float(3)
bool(false)

Test 5.
bool(true)
float(1)
bool(false)

Test 6.
bool(true)
float(1)

Test 7.
bool(true)
bool(false)
Done