Skip to content

Commit ec158c2

Browse files
committed
Catch type errors so test completes and doesn't diff
1 parent 16d79d7 commit ec158c2

File tree

1 file changed

+30
-24
lines changed

1 file changed

+30
-24
lines changed

ext/oci8/tests/conn_attr_4.phpt

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if (!(isset($matches[0]) &&
1515
($matches[1] >= 12)
1616
))) {
1717
// Bug fixed in 11.2 prevents client_info being reset
18-
die("skip expected output only valid when using Oracle 11gR2 or greater database server");
18+
die("skip expected output only valid when using Oracle 11gR2 or greater database server");
1919
}
2020
?>
2121
--FILE--
@@ -30,20 +30,32 @@ $attr_array = array('MODULE','ACTION','CLIENT_INFO','CLIENT_IDENTIFIER');
3030

3131
echo"**Test Negative cases************\n";
3232

33-
echo "\nInvalid Connection resource\n";
33+
echo "\nInvalid Connection resource 1\n";
3434
$nc1=NULL;
3535
// Invalid connection handle.
36-
var_dump(oci_set_action($nc1,$nc1));
36+
try {
37+
oci_set_action($nc1,$nc1);
38+
} catch (TypeError $e) {
39+
var_dump($e->getMessage());
40+
}
3741

3842
// Variable instead of a connection resource.
3943
echo "\nInvalid Connection resource 2\n";
4044
$str1= 'not a conn';
41-
var_dump(oci_set_client_info($str1,$str1));
45+
try {
46+
oci_set_client_info($str1,$str1);
47+
} catch (TypeError $e) {
48+
var_dump($e->getMessage());
49+
}
4250

4351
// Setting an Invalid value.
44-
echo "\nInvalid Value \n";
52+
echo "\nInvalid Action value \n";
4553
$c1=oci_connect($testuser,$testpassword,$dbase);
46-
var_dump(oci_set_action($c1,$c1));
54+
try {
55+
oci_set_action($c1,$c1);
56+
} catch (TypeError $e) {
57+
var_dump($e->getMessage());
58+
}
4759

4860
// Setting values multiple times.
4961
echo "\nSet Values multiple times \n";
@@ -77,39 +89,33 @@ echo "Done\n";
7789
--EXPECTF--
7890
**Test Negative cases************
7991

80-
Invalid Connection resource
81-
82-
Warning: oci_set_action(): Argument #1 must be of type resource, null given in %s on line %d
83-
NULL
92+
Invalid Connection resource 1
93+
string(89) "oci_set_action(): Argument #1 ($connection_resource) must be of type resource, null given"
8494

8595
Invalid Connection resource 2
96+
string(96) "oci_set_client_info(): Argument #1 ($connection_resource) must be of type resource, string given"
8697

87-
Warning: oci_set_client_info(): Argument #1 must be of type resource, %s given in %s on line %d
88-
NULL
89-
90-
Invalid Value
91-
92-
Warning: oci_set_action(): Argument #2 must be of type %s, resource given in %s on line %d
93-
NULL
98+
Invalid Action value
99+
string(78) "oci_set_action(): Argument #2 ($action) must be of type string, resource given"
94100

95-
Set Values multiple times
101+
Set Values multiple times
96102
bool(true)
97103
bool(true)
98104
bool(true)
99105
bool(true)
100106
The value of ACTION is ACTION1
101107

102-
Setting to different values
108+
Setting to different values
103109
Values set successfully to 1000
104110
The value of MODULE is 1000
105111
The value of ACTION is 1000
106112
The value of CLIENT_INFO is 1000
107113
The value of CLIENT_IDENTIFIER is 1000
108-
Values set successfully to
109-
The value of MODULE is
110-
The value of ACTION is
111-
The value of CLIENT_INFO is
112-
The value of CLIENT_IDENTIFIER is
114+
Values set successfully to
115+
The value of MODULE is
116+
The value of ACTION is
117+
The value of CLIENT_INFO is
118+
The value of CLIENT_IDENTIFIER is
113119

114120
Warning: oci_set_module_name(): ORA-24960: %s OCI_ATTR_MODULE %s on line %d
115121

0 commit comments

Comments
 (0)