diff options
author | Christopher Jones <sixd@php.net> | 2020-09-08 16:49:54 +1000 |
---|---|---|
committer | Christopher Jones <sixd@php.net> | 2020-09-08 16:49:54 +1000 |
commit | ec158c25c407c0473b421654a4e88fc5623a93b4 (patch) | |
tree | 177a43132a2f07943f19b8b5c8dde4b420c75526 | |
parent | 16d79d7accbbf978323ed1b0e0bf0e0a8ba46834 (diff) | |
download | php-git-ec158c25c407c0473b421654a4e88fc5623a93b4.tar.gz |
Catch type errors so test completes and doesn't diff
-rw-r--r-- | ext/oci8/tests/conn_attr_4.phpt | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/ext/oci8/tests/conn_attr_4.phpt b/ext/oci8/tests/conn_attr_4.phpt index 72ed493d8a..20282d1687 100644 --- a/ext/oci8/tests/conn_attr_4.phpt +++ b/ext/oci8/tests/conn_attr_4.phpt @@ -15,7 +15,7 @@ if (!(isset($matches[0]) && ($matches[1] >= 12) ))) { // Bug fixed in 11.2 prevents client_info being reset - die("skip expected output only valid when using Oracle 11gR2 or greater database server"); + die("skip expected output only valid when using Oracle 11gR2 or greater database server"); } ?> --FILE-- @@ -30,20 +30,32 @@ $attr_array = array('MODULE','ACTION','CLIENT_INFO','CLIENT_IDENTIFIER'); echo"**Test Negative cases************\n"; -echo "\nInvalid Connection resource\n"; +echo "\nInvalid Connection resource 1\n"; $nc1=NULL; // Invalid connection handle. -var_dump(oci_set_action($nc1,$nc1)); +try { + oci_set_action($nc1,$nc1); +} catch (TypeError $e) { + var_dump($e->getMessage()); +} // Variable instead of a connection resource. echo "\nInvalid Connection resource 2\n"; $str1= 'not a conn'; -var_dump(oci_set_client_info($str1,$str1)); +try { + oci_set_client_info($str1,$str1); +} catch (TypeError $e) { + var_dump($e->getMessage()); +} // Setting an Invalid value. -echo "\nInvalid Value \n"; +echo "\nInvalid Action value \n"; $c1=oci_connect($testuser,$testpassword,$dbase); -var_dump(oci_set_action($c1,$c1)); +try { + oci_set_action($c1,$c1); +} catch (TypeError $e) { + var_dump($e->getMessage()); +} // Setting values multiple times. echo "\nSet Values multiple times \n"; @@ -77,39 +89,33 @@ echo "Done\n"; --EXPECTF-- **Test Negative cases************ -Invalid Connection resource - -Warning: oci_set_action(): Argument #1 must be of type resource, null given in %s on line %d -NULL +Invalid Connection resource 1 +string(89) "oci_set_action(): Argument #1 ($connection_resource) must be of type resource, null given" Invalid Connection resource 2 +string(96) "oci_set_client_info(): Argument #1 ($connection_resource) must be of type resource, string given" -Warning: oci_set_client_info(): Argument #1 must be of type resource, %s given in %s on line %d -NULL - -Invalid Value - -Warning: oci_set_action(): Argument #2 must be of type %s, resource given in %s on line %d -NULL +Invalid Action value +string(78) "oci_set_action(): Argument #2 ($action) must be of type string, resource given" -Set Values multiple times +Set Values multiple times bool(true) bool(true) bool(true) bool(true) The value of ACTION is ACTION1 -Setting to different values +Setting to different values Values set successfully to 1000 The value of MODULE is 1000 The value of ACTION is 1000 The value of CLIENT_INFO is 1000 The value of CLIENT_IDENTIFIER is 1000 -Values set successfully to -The value of MODULE is -The value of ACTION is -The value of CLIENT_INFO is -The value of CLIENT_IDENTIFIER is +Values set successfully to +The value of MODULE is +The value of ACTION is +The value of CLIENT_INFO is +The value of CLIENT_IDENTIFIER is Warning: oci_set_module_name(): ORA-24960: %s OCI_ATTR_MODULE %s on line %d |