Skip to content

Commit 58a65c4

Browse files
jensdenieskocsismate
authored andcommitted
Fixed some oci8 tests.
Closes GH-5716
1 parent bdd8406 commit 58a65c4

25 files changed

+110
-324
lines changed

ext/oci8/tests/bug51291_1.phpt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ echo "\nTest 2 - Parse\n";
2020

2121
$s = @oci_parse($c, "select ' from dual");
2222
if (!$s) {
23-
var_dump(oci_error(), oci_error($c), oci_error($s));
23+
var_dump(oci_error(), oci_error($c));
2424
echo "2nd call\n";
25-
var_dump(oci_error(), oci_error($c), oci_error($s));
25+
var_dump(oci_error(), oci_error($c));
2626
}
2727

2828
echo "\nTest 3 - Execute\n";
@@ -164,8 +164,6 @@ array(4) {
164164
}
165165

166166
Test 2 - Parse
167-
168-
Warning: oci_error(): Argument #1 must be of type resource, bool%sgiven in %sbug51291_1.php on line %d
169167
bool(false)
170168
array(4) {
171169
["code"]=>
@@ -177,10 +175,7 @@ array(4) {
177175
["sqltext"]=>
178176
string(0) ""
179177
}
180-
NULL
181178
2nd call
182-
183-
Warning: oci_error(): Argument #1 must be of type resource, bool%sgiven in %sbug51291_1.php on line %d
184179
bool(false)
185180
array(4) {
186181
["code"]=>
@@ -192,7 +187,6 @@ array(4) {
192187
["sqltext"]=>
193188
string(0) ""
194189
}
195-
NULL
196190

197191
Test 3 - Execute
198192
array(4) {

ext/oci8/tests/coll_002_func.phpt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ require __DIR__."/create_type.inc";
1414
var_dump($coll1 = oci_new_collection($c, $type_name));
1515

1616
var_dump(oci_free_collection($coll1));
17-
var_dump(oci_collection_size($coll1));
17+
18+
try {
19+
var_dump(oci_collection_size($coll1));
20+
} catch(\TypeError $exception) {
21+
var_dump($exception->getMessage());
22+
}
1823

1924
echo "Done\n";
2025

@@ -27,7 +32,5 @@ object(OCI-Collection)#%d (1) {
2732
resource(%d) of type (oci8 collection)
2833
}
2934
bool(true)
30-
31-
Warning: oci_collection_size(): supplied resource is not a valid oci8 collection resource in %s on line %d
32-
bool(false)
35+
string(%d) "oci_collection_size(): supplied resource is not a valid oci8 collection resource"
3336
Done

ext/oci8/tests/coll_018.phpt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ require __DIR__."/create_type.inc";
1313

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

16-
echo "Test 1.\n";
17-
var_dump($coll1->trim());
18-
1916
echo "\nTest 2.\n";
2017
var_dump($coll1->trim(0));
2118

@@ -56,11 +53,6 @@ require __DIR__."/drop_type.inc";
5653

5754
?>
5855
--EXPECTF--
59-
Test 1.
60-
61-
Warning: OCI-Collection::trim() expects exactly 1 parameter, 0 given in %s on line 9
62-
NULL
63-
6456
Test 2.
6557
bool(true)
6658

ext/oci8/tests/define1.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ $string = '';
2727
var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
2828
var_dump(oci_define_by_name($stmt, "STRING", $string, 20));
2929
var_dump(oci_define_by_name($stmt, "", $string, 20));
30-
var_dump(oci_define_by_name($stmt, ""));
3130

3231
oci_execute($stmt);
3332

@@ -52,8 +51,5 @@ bool(false)
5251

5352
Warning: oci_define_by_name(): Column name cannot be empty in %s on line %d
5453
bool(false)
55-
56-
Warning: oci_define_by_name() expects at least 3 parameters, 2 given in %s on line %d
57-
NULL
5854
string(4) "some"
5955
Done

ext/oci8/tests/define4.phpt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,12 @@ while (oci_fetch($stmt)) {
4141
echo "Test 3\n";
4242
var_dump(oci_free_statement($stmt));
4343
var_dump($string);
44-
var_dump(oci_result($stmt, 'STRING'));
4544

45+
try {
46+
var_dump(oci_result($stmt, 'STRING'));
47+
} catch(\TypeError $exception) {
48+
var_dump($exception->getMessage());
49+
}
4650
// Cleanup
4751

4852
$stmtarray = array(
@@ -67,7 +71,5 @@ string(4) "some"
6771
Test 3
6872
bool(true)
6973
string(4) "some"
70-
71-
Warning: oci_result(): supplied resource is not a valid oci8 statement resource in %s on line %d
72-
bool(false)
74+
string(%d) "oci_result(): supplied resource is not a valid oci8 statement resource"
7375
Done

ext/oci8/tests/fetch_object_2.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ if (!oci_execute($s)) {
5050

5151
while ($row = oci_fetch_object($s)) {
5252
echo $row->COL1 . "\n";
53-
echo $row->COL2->load(100) . "\n";
53+
echo $row->COL2->load() . "\n";
5454
echo $row->COL3 . "\n";
5555
}
5656

ext/oci8/tests/field_funcs1.phpt

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,6 @@ var_dump(oci_field_scale($s, "none"));
5050
var_dump(oci_field_precision($s, "none"));
5151
var_dump(oci_field_size($s, "none"));
5252

53-
echo "Test 3\n";
54-
var_dump(oci_field_is_null($c, -1));
55-
var_dump(oci_field_name($c, -1));
56-
var_dump(oci_field_type($c, -1));
57-
var_dump(oci_field_type_raw($c, -1));
58-
var_dump(oci_field_scale($c, -1));
59-
var_dump(oci_field_precision($c, -1));
60-
var_dump(oci_field_size($c, -1));
61-
6253
echo "Test 4\n";
6354
var_dump(oci_field_is_null($s, array()));
6455
var_dump(oci_field_name($s, array()));
@@ -68,9 +59,6 @@ var_dump(oci_field_scale($s, array()));
6859
var_dump(oci_field_precision($s, array()));
6960
var_dump(oci_field_size($s, array()));
7061

71-
var_dump(oci_field_size($s));
72-
73-
7462
// Cleanup
7563

7664
$stmtarray = array(
@@ -133,28 +121,6 @@ bool(false)
133121

134122
Warning: oci_field_size(): Invalid column name "none" in %s on line %d
135123
bool(false)
136-
Test 3
137-
138-
Warning: oci_field_is_null(): supplied resource is not a valid oci8 statement resource in %s on line %d
139-
bool(false)
140-
141-
Warning: oci_field_name(): supplied resource is not a valid oci8 statement resource in %s on line %d
142-
bool(false)
143-
144-
Warning: oci_field_type(): supplied resource is not a valid oci8 statement resource in %s on line %d
145-
bool(false)
146-
147-
Warning: oci_field_type_raw(): supplied resource is not a valid oci8 statement resource in %s on line %d
148-
bool(false)
149-
150-
Warning: oci_field_scale(): supplied resource is not a valid oci8 statement resource in %s on line %d
151-
bool(false)
152-
153-
Warning: oci_field_precision(): supplied resource is not a valid oci8 statement resource in %s on line %d
154-
bool(false)
155-
156-
Warning: oci_field_size(): supplied resource is not a valid oci8 statement resource in %s on line %d
157-
bool(false)
158124
Test 4
159125

160126
Warning: oci_field_is_null(): Invalid column index "0" in %s on line %d
@@ -177,7 +143,4 @@ bool(false)
177143

178144
Warning: oci_field_size(): Invalid column index "0" in %s on line %d
179145
bool(false)
180-
181-
Warning: oci_field_size() expects exactly 2 parameters, 1 given in %s on line %d
182-
bool(false)
183146
Done

ext/oci8/tests/imp_res_close.phpt

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,17 @@ oci8_test_sql_execute($c, $stmtarray);
4141
echo "Test 1\n";
4242
$s = oci_parse($c, "begin imp_res_close_proc(); end;");
4343
oci_execute($s);
44-
while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
45-
foreach ($row as $item) {
46-
echo " ".$item;
44+
45+
try {
46+
while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
47+
foreach ($row as $item) {
48+
echo " ".$item;
49+
}
50+
echo "\n";
51+
oci_free_statement($s); // Free the implicit result handle
4752
}
48-
echo "\n";
49-
oci_free_statement($s); // Free the implicit result handle
53+
} catch(\TypeError $exception) {
54+
var_dump($exception->getMessage());
5055
}
5156

5257
// Clean up
@@ -61,5 +66,4 @@ oci8_test_sql_execute($c, $stmtarray);
6166
--EXPECTF--
6267
Test 1
6368
1
64-
65-
Warning: oci_fetch_array(): supplied resource is not a valid oci8 statement resource in %simp_res_close.php on line %d
69+
string(%d) "oci_fetch_array(): supplied resource is not a valid oci8 statement resource"

ext/oci8/tests/imp_res_get_close_1.phpt

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,23 @@ echo "Test 1\n";
4040
$s = oci_parse($c, $plsql);
4141
oci_execute($s);
4242

43-
while (($s1 = oci_get_implicit_resultset($s))) {
44-
while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
45-
foreach ($row as $item) {
46-
echo " ".$item;
43+
try {
44+
while (($s1 = oci_get_implicit_resultset($s))) {
45+
while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
46+
foreach ($row as $item) {
47+
echo " ".$item;
48+
}
49+
echo "\n";
50+
oci_free_statement($s1); // Free the implicit result handle
4751
}
48-
echo "\n";
49-
oci_free_statement($s1); // Free the implicit result handle
5052
}
53+
oci_free_statement($s);
54+
} catch(\TypeError $exception) {
55+
var_dump($exception->getMessage());
5156
}
52-
oci_free_statement($s);
5357

5458
?>
5559
--EXPECTF--
5660
Test 1
5761
1
58-
59-
Warning: oci_fetch_array(): supplied resource is not a valid oci8 statement resource in %s on line %d
60-
3
61-
62-
Warning: oci_fetch_array(): supplied resource is not a valid oci8 statement resource in %s on line %d
63-
5
64-
65-
Warning: oci_fetch_array(): supplied resource is not a valid oci8 statement resource in %s on line %d
62+
string(%d) "oci_fetch_array(): supplied resource is not a valid oci8 statement resource"

ext/oci8/tests/imp_res_get_close_2.phpt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,18 @@ echo "Test 1\n";
4040
$s = oci_parse($c, $plsql);
4141
oci_execute($s);
4242

43-
while (($s1 = oci_get_implicit_resultset($s))) {
44-
while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
45-
foreach ($row as $item) {
46-
echo " ".$item;
43+
try {
44+
while (($s1 = oci_get_implicit_resultset($s))) {
45+
while (($row = oci_fetch_array($s1, OCI_ASSOC+OCI_RETURN_NULLS)) != false) {
46+
foreach ($row as $item) {
47+
echo " ".$item;
48+
}
49+
echo "\n";
50+
oci_free_statement($s); // close parent
4751
}
48-
echo "\n";
49-
oci_free_statement($s); // close parent
5052
}
53+
} catch(\TypeError $exception) {
54+
var_dump($exception->getMessage());
5155
}
5256

5357
?>
@@ -56,5 +60,4 @@ Test 1
5660
1
5761

5862
Warning: oci_fetch_array(): OCI_INVALID_HANDLE in %s on line %d
59-
60-
Warning: oci_get_implicit_resultset(): supplied resource is not a valid oci8 statement resource in %s on line %d
63+
string(%d) "oci_get_implicit_resultset(): supplied resource is not a valid oci8 statement resource"

ext/oci8/tests/lob_002.phpt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,9 @@ oci_execute($statement, OCI_DEFAULT);
2727
var_dump($blob);
2828

2929
var_dump($blob->write("test", -1));
30-
var_dump($blob->write("test", "str"));
3130
var_dump($blob->write("test", 1000000));
3231
var_dump($blob->write(str_repeat("test", 10000), 1000000));
3332
var_dump($blob->tell());
34-
var_dump($blob->seek("str", -5));
3533
var_dump($blob->flush());
3634

3735
oci_commit($c);
@@ -59,14 +57,8 @@ object(OCI-Lob)#%d (1) {
5957
resource(%d) of type (oci8 descriptor)
6058
}
6159
int(0)
62-
63-
Warning: OCI-Lob::write(): Argument #2 must be of type int%s string given in %slob_002.php on line %d
64-
NULL
6560
int(4)
6661
int(40000)
6762
int(40004)
68-
69-
Warning: OCI-Lob::seek(): Argument #1 must be of type int%s string given in %slob_002.php on line %d
70-
NULL
7163
bool(false)
7264
int(40004)

ext/oci8/tests/lob_014.phpt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ var_dump($blob->write("test"));
2929
var_dump($blob->close());
3030
var_dump($blob->write("test"));
3131
var_dump($blob->free());
32-
var_dump($blob->write("test"));
3332

3433
oci_commit($c);
3534

@@ -49,9 +48,6 @@ int(4)
4948
bool(true)
5049
int(4)
5150
bool(true)
52-
53-
Warning: OCI-Lob::write(): %s is not a valid oci8 descriptor resource in %slob_014.php on line %d
54-
bool(false)
5551
array(1) {
5652
[0]=>
5753
string(8) "testtest"

ext/oci8/tests/lob_015.phpt

Lines changed: 0 additions & 54 deletions
This file was deleted.

ext/oci8/tests/lob_020.phpt

-252 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)