summaryrefslogtreecommitdiff
path: root/ext/oci8/tests
diff options
context:
space:
mode:
authorChristopher Jones <sixd@php.net>2013-09-06 08:14:18 -0700
committerChristopher Jones <sixd@php.net>2013-09-06 08:14:18 -0700
commite504ed66a84815d3e2e9fd0e3679c787c14b2691 (patch)
treecd9a675d1034e9d0ad9b6c57776dbeaf8a86d8e3 /ext/oci8/tests
parent4b778faa8014947390d55dbc71e15ae0d7aca53a (diff)
downloadphp-git-e504ed66a84815d3e2e9fd0e3679c787c14b2691.tar.gz
Add test for oci_set_* error changes
Diffstat (limited to 'ext/oci8/tests')
-rw-r--r--ext/oci8/tests/error_set.phpt72
1 files changed, 72 insertions, 0 deletions
diff --git a/ext/oci8/tests/error_set.phpt b/ext/oci8/tests/error_set.phpt
new file mode 100644
index 0000000000..ad56e8aefa
--- /dev/null
+++ b/ext/oci8/tests/error_set.phpt
@@ -0,0 +1,72 @@
+--TEST--
+Check oci_set_{action,client_identifier,module_name,client_info} error handling
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+error_reporting(E_ALL);
+ini_set('display_errors', 'Off');
+
+echo "Test 1\n";
+
+// Generates "ORA-24960: the attribute OCI_ATTR_* is greater than the maximum allowable length of 64"
+$s = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
+
+$r = oci_set_action($c, $s);
+var_dump($r);
+$m = oci_error($c);
+echo $m['code'] , "\n";
+
+$r = oci_set_client_identifier($c, $s);
+var_dump($r);
+$m = oci_error($c);
+echo $m['code'] , "\n";
+
+$r = oci_set_module_name($c, $s);
+var_dump($r);
+$m = oci_error($c);
+echo $m['code'] , "\n";
+
+$r = oci_set_client_info($c, $s);
+var_dump($r);
+$m = oci_error($c);
+echo $m['code'] , "\n";
+
+echo "\nTest 2\n";
+$s = "x";
+
+$r = oci_set_action($c, $s);
+var_dump($r);
+
+$r = oci_set_client_identifier($c, $s);
+var_dump($r);
+
+$r = oci_set_module_name($c, $s);
+var_dump($r);
+
+$r = oci_set_client_info($c, $s);
+var_dump($r);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+bool(false)
+24960
+bool(false)
+24960
+bool(false)
+24960
+bool(false)
+24960
+
+Test 2
+bool(true)
+bool(true)
+bool(true)
+bool(true)
+===DONE===