summaryrefslogtreecommitdiff
path: root/ext/oci8/tests
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2010-01-07 13:31:53 +0100
committerOndřej Surý <ondrej@sury.org>2010-01-07 13:31:53 +0100
commit0fab6db7cac8d2be99579dd049f812a8ff98e74f (patch)
tree91f01b0d06916c78262404096bfd466b8e95e5b5 /ext/oci8/tests
parentd3a8757891280dc6650ca7eead67830c794b0e7b (diff)
downloadphp-0fab6db7cac8d2be99579dd049f812a8ff98e74f.tar.gz
Imported Upstream version 5.3.1upstream/5.3.1
Diffstat (limited to 'ext/oci8/tests')
-rw-r--r--ext/oci8/tests/connect.inc12
-rw-r--r--ext/oci8/tests/details.inc62
-rw-r--r--ext/oci8/tests/extauth_01.phpt56
-rw-r--r--ext/oci8/tests/extauth_02.phpt56
-rw-r--r--ext/oci8/tests/extauth_03.phpt56
-rw-r--r--ext/oci8/tests/oci8safemode.phpt2
-rw-r--r--ext/oci8/tests/pecl_bug16842.phpt69
-rw-r--r--ext/oci8/tests/xmltype_01.phpt2
8 files changed, 195 insertions, 120 deletions
diff --git a/ext/oci8/tests/connect.inc b/ext/oci8/tests/connect.inc
index 8a116290e..5e340cf6f 100644
--- a/ext/oci8/tests/connect.inc
+++ b/ext/oci8/tests/connect.inc
@@ -1,18 +1,18 @@
<?php
-include "details.inc";
+require("details.inc");
if (!empty($dbase)) {
- $c = @oci_connect($user, $password, $dbase);
+ $c = @oci_connect($user, $password, $dbase);
}
else {
- $c = @oci_connect($user, $password);
+ $c = @oci_connect($user, $password);
}
if (!$c) {
- echo "connect.inc: Failed to connect as '$user' to '$dbase'\n";
- $e = oci_error();
- echo $e['message']."\n";
+ echo "connect.inc: Failed to connect as '$user' to '$dbase'\n";
+ $e = oci_error();
+ echo $e['message']."\n";
}
?>
diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc
index 0c53823ee..75a136ce3 100644
--- a/ext/oci8/tests/details.inc
+++ b/ext/oci8/tests/details.inc
@@ -14,36 +14,40 @@
* string like hostname:port/service_name:POOLED
*/
-if (false !== getenv('PHP_OCI8_TEST_DB')) {
- $user = getenv('PHP_OCI8_TEST_USER'); // Database username for tests
- $password = getenv('PHP_OCI8_TEST_PASS'); // Password for $user
- $dbase = getenv('PHP_OCI8_TEST_DB'); // Database connection string
- $test_drcp = getenv('PHP_OCI8_TEST_DRCP');
- if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) {
- $test_drcp = TRUE;
- } else {
- $test_drcp = FALSE;
- }
- $oracle_on_localhost = getenv('PHP_OCI8_TEST_DB_ON_LOCALHOST');
- if (false !== $oracle_on_localhost && 0 == strcasecmp($oracle_on_localhost,'TRUE')) {
- $oracle_on_localhost = TRUE;
- } else {
- $oracle_on_localhost = FALSE;
- }
+if (file_exists(dirname(__FILE__)."/details_local.inc")) {
+ include(dirname(__FILE__)."/details_local.inc"); // this file is not part of the source distribution; make it your own local variant of details.inc
} else {
- $user = "system";
- $password = "oracle";
- $dbase = "localhost/XE";
- $oracle_on_localhost = TRUE;
- $test_drcp = FALSE;
+ if (false !== getenv('PHP_OCI8_TEST_DB')) {
+ $user = getenv('PHP_OCI8_TEST_USER'); // Database username for tests
+ $password = getenv('PHP_OCI8_TEST_PASS'); // Password for $user
+ $dbase = getenv('PHP_OCI8_TEST_DB'); // Database connection string
+ $test_drcp = getenv('PHP_OCI8_TEST_DRCP');
+ if (false !== $test_drcp && 0 == strcasecmp($test_drcp,'TRUE')) {
+ $test_drcp = TRUE;
+ } else {
+ $test_drcp = FALSE;
+ }
+ $oracle_on_localhost = getenv('PHP_OCI8_TEST_DB_ON_LOCALHOST');
+ if (false !== $oracle_on_localhost && 0 == strcasecmp($oracle_on_localhost,'TRUE')) {
+ $oracle_on_localhost = TRUE;
+ } else {
+ $oracle_on_localhost = FALSE;
+ }
+ } else {
+ $user = "system";
+ $password = "oracle";
+ $dbase = "localhost/XE";
+ $oracle_on_localhost = TRUE;
+ $test_drcp = FALSE;
+ }
+
+ /*
+ * Common object names for scripts to use
+ */
+
+ $table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
+ $type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
+ $schema = '';
}
-/*
- * Common object names for scripts to use
- */
-
-$table_name = "tb".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5);
-$type_name = strtoupper("tp".substr(str_replace(Array(".", "-"), "_", php_uname("n")), 0, 5));
-$schema = '';
-
?>
diff --git a/ext/oci8/tests/extauth_01.phpt b/ext/oci8/tests/extauth_01.phpt
index 850b1385d..e054a2216 100644
--- a/ext/oci8/tests/extauth_01.phpt
+++ b/ext/oci8/tests/extauth_01.phpt
@@ -141,56 +141,56 @@ Test 7
Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
- ["code"]=>
+ [%u|b%"code"]=>
int(12154)
- ["message"]=>
- string(65) "ORA-12154: %s"
- ["offset"]=>
+ [%u|b%"message"]=>
+ %unicode|string%(65) "ORA-12154: %s"
+ [%u|b%"offset"]=>
int(0)
- ["sqltext"]=>
- string(0) ""
+ [%u|b%"sqltext"]=>
+ %unicode|string%(0) ""
}
bool(false)
Test 8
Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
- ["code"]=>
+ [%u|b%"code"]=>
int(12154)
- ["message"]=>
- string(65) "ORA-12154: %s"
- ["offset"]=>
+ [%u|b%"message"]=>
+ %unicode|string%(65) "ORA-12154: %s"
+ [%u|b%"offset"]=>
int(0)
- ["sqltext"]=>
- string(0) ""
+ [%u|b%"sqltext"]=>
+ %unicode|string%(0) ""
}
bool(false)
Test 9
-Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
+Warning: oci_connect(): ORA-%d: TNS:%s in %s on line %d
array(4) {
- ["code"]=>
- int(12154)
- ["message"]=>
- string(65) "ORA-12154: %s"
- ["offset"]=>
+ [%u|b%"code"]=>
+ int(%d)
+ [%u|b%"message"]=>
+ %unicode|string%(%d) "ORA-%d: %s"
+ [%u|b%"offset"]=>
int(0)
- ["sqltext"]=>
- string(0) ""
+ [%u|b%"sqltext"]=>
+ %unicode|string%(0) ""
}
bool(false)
Test 10
-Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
+Warning: oci_connect(): ORA-%d: TNS:%s in %s on line %d
array(4) {
- ["code"]=>
- int(12154)
- ["message"]=>
- string(65) "ORA-12154: %s"
- ["offset"]=>
+ [%u|b%"code"]=>
+ int(%d)
+ [%u|b%"message"]=>
+ %unicode|string%(%d) "ORA-%d: %s"
+ [%u|b%"offset"]=>
int(0)
- ["sqltext"]=>
- string(0) ""
+ [%u|b%"sqltext"]=>
+ %unicode|string%(0) ""
}
bool(false)
===DONE===
diff --git a/ext/oci8/tests/extauth_02.phpt b/ext/oci8/tests/extauth_02.phpt
index df9cb5eb0..b27522961 100644
--- a/ext/oci8/tests/extauth_02.phpt
+++ b/ext/oci8/tests/extauth_02.phpt
@@ -141,56 +141,56 @@ Test 7
Warning: oci_new_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
- ["code"]=>
+ [%u|b%"code"]=>
int(12154)
- ["message"]=>
- string(65) "ORA-12154: %s"
- ["offset"]=>
+ [%u|b%"message"]=>
+ %unicode|string%(65) "ORA-12154: %s"
+ [%u|b%"offset"]=>
int(0)
- ["sqltext"]=>
- string(0) ""
+ [%u|b%"sqltext"]=>
+ %unicode|string%(0) ""
}
bool(false)
Test 8
Warning: oci_new_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
- ["code"]=>
+ [%u|b%"code"]=>
int(12154)
- ["message"]=>
- string(65) "ORA-12154: %s"
- ["offset"]=>
+ [%u|b%"message"]=>
+ %unicode|string%(65) "ORA-12154: %s"
+ [%u|b%"offset"]=>
int(0)
- ["sqltext"]=>
- string(0) ""
+ [%u|b%"sqltext"]=>
+ %unicode|string%(0) ""
}
bool(false)
Test 9
-Warning: oci_new_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
+Warning: oci_new_connect(): ORA-%d: TNS:%s %s on line %d
array(4) {
- ["code"]=>
- int(12154)
- ["message"]=>
- string(65) "ORA-12154: %s"
- ["offset"]=>
+ [%u|b%"code"]=>
+ int(%d)
+ [%u|b%"message"]=>
+ %unicode|string%(%d) "ORA-%d: %s"
+ [%u|b%"offset"]=>
int(0)
- ["sqltext"]=>
- string(0) ""
+ [%u|b%"sqltext"]=>
+ %unicode|string%(0) ""
}
bool(false)
Test 10
-Warning: oci_new_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
+Warning: oci_new_connect(): ORA-%d: TNS:%s %s on line %d
array(4) {
- ["code"]=>
- int(12154)
- ["message"]=>
- string(65) "ORA-12154: %s"
- ["offset"]=>
+ [%u|b%"code"]=>
+ int(%d)
+ [%u|b%"message"]=>
+ %unicode|string%(%d) "ORA-%d: %s"
+ [%u|b%"offset"]=>
int(0)
- ["sqltext"]=>
- string(0) ""
+ [%u|b%"sqltext"]=>
+ %unicode|string%(0) ""
}
bool(false)
===DONE===
diff --git a/ext/oci8/tests/extauth_03.phpt b/ext/oci8/tests/extauth_03.phpt
index 501274232..50be0e724 100644
--- a/ext/oci8/tests/extauth_03.phpt
+++ b/ext/oci8/tests/extauth_03.phpt
@@ -141,56 +141,56 @@ Test 7
Warning: oci_pconnect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
- ["code"]=>
+ [%u|b%"code"]=>
int(12154)
- ["message"]=>
- string(65) "ORA-12154: %s"
- ["offset"]=>
+ [%u|b%"message"]=>
+ %unicode|string%(65) "ORA-12154: %s"
+ [%u|b%"offset"]=>
int(0)
- ["sqltext"]=>
- string(0) ""
+ [%u|b%"sqltext"]=>
+ %unicode|string%(0) ""
}
bool(false)
Test 8
Warning: oci_pconnect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
array(4) {
- ["code"]=>
+ [%u|b%"code"]=>
int(12154)
- ["message"]=>
- string(65) "ORA-12154: %s"
- ["offset"]=>
+ [%u|b%"message"]=>
+ %unicode|string%(65) "ORA-12154: %s"
+ [%u|b%"offset"]=>
int(0)
- ["sqltext"]=>
- string(0) ""
+ [%u|b%"sqltext"]=>
+ %unicode|string%(0) ""
}
bool(false)
Test 9
-Warning: oci_pconnect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
+Warning: oci_pconnect(): ORA-%d: TNS:%s in %s on line %d
array(4) {
- ["code"]=>
- int(12154)
- ["message"]=>
- string(65) "ORA-12154: %s"
- ["offset"]=>
+ [%u|b%"code"]=>
+ int(%d)
+ [%u|b%"message"]=>
+ %unicode|string%(%d) "ORA-%d: %s"
+ [%u|b%"offset"]=>
int(0)
- ["sqltext"]=>
- string(0) ""
+ [%u|b%"sqltext"]=>
+ %unicode|string%(0) ""
}
bool(false)
Test 10
-Warning: oci_pconnect(): ORA-12154: TNS:could not resolve the connect identifier specified in %s on line %d
+Warning: oci_pconnect(): ORA-%d: TNS:%s in %s on line %d
array(4) {
- ["code"]=>
- int(12154)
- ["message"]=>
- string(65) "ORA-12154: %s"
- ["offset"]=>
+ [%u|b%"code"]=>
+ int(%d)
+ [%u|b%"message"]=>
+ %unicode|string%(%d) "ORA-%d: %s"
+ [%u|b%"offset"]=>
int(0)
- ["sqltext"]=>
- string(0) ""
+ [%u|b%"sqltext"]=>
+ %unicode|string%(0) ""
}
bool(false)
===DONE===
diff --git a/ext/oci8/tests/oci8safemode.phpt b/ext/oci8/tests/oci8safemode.phpt
index 4662b4448..112e544c8 100644
--- a/ext/oci8/tests/oci8safemode.phpt
+++ b/ext/oci8/tests/oci8safemode.phpt
@@ -15,6 +15,8 @@ $r = oci_password_change($c, "hr", "hrpwd", "hrpwd");
echo "Done\n";
?>
--EXPECTF--
+PHP Warning: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line 0
+
Warning: oci_connect(): Privileged connect is disabled in Safe Mode in %s on line %d
Warning: oci_password_change(): is disabled in Safe Mode in %s on line %d
diff --git a/ext/oci8/tests/pecl_bug16842.phpt b/ext/oci8/tests/pecl_bug16842.phpt
new file mode 100644
index 000000000..d796d2506
--- /dev/null
+++ b/ext/oci8/tests/pecl_bug16842.phpt
@@ -0,0 +1,69 @@
+--TEST--
+PECL Bug #16842 (NO_DATA_FOUND exception is a warning)
+--SKIPIF--
+<?php if (!extension_loaded('oci8')) die ("skip no oci8 extension"); ?>
+--INI--
+error_reporting = E_WARNING
+--FILE--
+<?php
+
+require(dirname(__FILE__).'/connect.inc');
+
+// Run Test
+
+echo "Test 1\n";
+
+echo "Raises NO_DATA_FOUND\n";
+$s = oci_parse($c, 'begin raise NO_DATA_FOUND; end;');
+$e = oci_execute($s);
+var_dump($e);
+var_dump(oci_error($s));
+
+echo "Test 2\n";
+
+echo "Raises ZERO_DIVIDE\n";
+$s = oci_parse($c, 'begin raise ZERO_DIVIDE; end;');
+$e = oci_execute($s);
+var_dump($e);
+var_dump(oci_error($s));
+
+oci_close($c);
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+Test 1
+Raises NO_DATA_FOUND
+
+Warning: oci_execute(): OCI_NO_DATA in %s on line 11
+bool(false)
+array(4) {
+ [%u|b%"code"]=>
+ int(1403)
+ [%u|b%"message"]=>
+ %unicode|string%(45) "ORA-01403: %s
+ORA-06512: at line 1"
+ [%u|b%"offset"]=>
+ int(0)
+ [%u|b%"sqltext"]=>
+ %unicode|string%(31) "begin raise NO_DATA_FOUND; end;"
+}
+Test 2
+Raises ZERO_DIVIDE
+
+Warning: oci_execute(): ORA-01476: %s
+ORA-06512: at line 1 in %s on line 19
+bool(false)
+array(4) {
+ [%u|b%"code"]=>
+ int(1476)
+ [%u|b%"message"]=>
+ %unicode|string%(56) "ORA-01476: %s
+ORA-06512: at line 1"
+ [%u|b%"offset"]=>
+ int(0)
+ [%u|b%"sqltext"]=>
+ %unicode|string%(29) "begin raise ZERO_DIVIDE; end;"
+}
+===DONE===
diff --git a/ext/oci8/tests/xmltype_01.phpt b/ext/oci8/tests/xmltype_01.phpt
index 49420259f..a9458c83d 100644
--- a/ext/oci8/tests/xmltype_01.phpt
+++ b/ext/oci8/tests/xmltype_01.phpt
@@ -2,7 +2,7 @@
Basic XMLType test
--SKIPIF--
<?php if (!extension_loaded('oci8')) die("skip no oci8 extension"); ?>
-<?php if (!extension_loaded("simplexml")) die("skip no simplexml extension"; ?>
+<?php if (!extension_loaded("simplexml")) die("skip no simplexml extension"); ?>
--FILE--
<?php