From: Antony Dovgal Date: Fri, 22 Dec 2006 13:28:46 +0000 (+0000) Subject: more OCI8 tests by Chris Jones X-Git-Tag: RELEASE_1_0_0RC1~547 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2010ae0c5cbf2429141026f39f64d5ddf9c21716;p=php more OCI8 tests by Chris Jones --- diff --git a/ext/oci8/tests/coll_018.phpt b/ext/oci8/tests/coll_018.phpt new file mode 100644 index 0000000000..f97cc49e7c --- /dev/null +++ b/ext/oci8/tests/coll_018.phpt @@ -0,0 +1,93 @@ +--TEST-- +Collection trim tests +--SKIPIF-- + +--FILE-- +trim()); + +echo "\nTest 2.\n"; +var_dump($coll1->trim(0)); + +echo "\nTest 3.\n"; +var_dump($coll1->append(1)); +var_dump($coll1->append(2)); +var_dump($coll1->append(3)); +var_dump($coll1->append(4)); + +var_dump($coll1->getElem(-1)); // check before the beginning +var_dump($coll1->getElem(0)); +var_dump($coll1->getElem(1)); +var_dump($coll1->getElem(2)); +var_dump($coll1->getElem(3)); +var_dump($coll1->getElem(4)); // check past the end + +echo "\nTest 4.\n"; +var_dump($coll1->trim(1)); +var_dump($coll1->getElem(2)); // this should be the last element +var_dump($coll1->getElem(3)); // this element should have gone + +echo "\nTest 5.\n"; +var_dump($coll1->trim(2)); +var_dump($coll1->getElem(0)); // this should be the last element +var_dump($coll1->getElem(1)); // this element should have gone + +echo "\nTest 6.\n"; +var_dump($coll1->trim(0)); +var_dump($coll1->getElem(0)); // this should still be the last element + +echo "\nTest 7.\n"; +var_dump($coll1->trim(1)); +var_dump($coll1->getElem(0)); // this should have gone + +echo "Done\n"; + +require dirname(__FILE__)."/drop_type.inc"; + +?> +--EXPECTF-- +Test 1. + +Warning: OCI-Collection::trim() expects exactly 1 parameter, 0 given in %s on line 9 +NULL + +Test 2. +bool(true) + +Test 3. +bool(true) +bool(true) +bool(true) +bool(true) +bool(false) +float(1) +float(2) +float(3) +float(4) +bool(false) + +Test 4. +bool(true) +float(3) +bool(false) + +Test 5. +bool(true) +float(1) +bool(false) + +Test 6. +bool(true) +float(1) + +Test 7. +bool(true) +bool(false) +Done diff --git a/ext/oci8/tests/error2.phpt b/ext/oci8/tests/error2.phpt new file mode 100644 index 0000000000..13ea6cebe2 --- /dev/null +++ b/ext/oci8/tests/error2.phpt @@ -0,0 +1,24 @@ +--TEST-- +Exercise error code for SUCCESS_WITH_INFO +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +ORA-24344: success with compilation error +Done diff --git a/ext/oci8/tests/lob_036.phpt b/ext/oci8/tests/lob_036.phpt new file mode 100644 index 0000000000..5c2972e467 --- /dev/null +++ b/ext/oci8/tests/lob_036.phpt @@ -0,0 +1,45 @@ +--TEST-- +Exercise cleanup code when LOB buffering is on +--SKIPIF-- + +--FILE-- +write("test")); +var_dump($blob->setBuffering(true)); +var_dump($blob->write("test")); + +$blob = null; + +require dirname(__FILE__).'/drop_table.inc'; + +echo "Done\n"; + +?> +--EXPECT-- +int(4) +bool(true) +int(4) +Done +--UEXPECT-- +int(8) +bool(true) +int(8) +Done diff --git a/ext/oci8/tests/statement_type.phpt b/ext/oci8/tests/statement_type.phpt index f7ac43efc8..78e6570dc9 100644 --- a/ext/oci8/tests/statement_type.phpt +++ b/ext/oci8/tests/statement_type.phpt @@ -7,22 +7,19 @@ oci_statement_type() require dirname(__FILE__)."/connect.inc"; -if (!empty($dbase)) { - var_dump($c = oci_connect($user, $password, $dbase)); -} -else { - var_dump($c = oci_connect($user, $password)); -} - $sqls = Array( - "SELECT * FROM table", - "DELETE FROM table WHERE id = 1", - "INSERT INTO table VALUES(1)", - "UPDATE table SET id = 1", - "DROP TABLE table", - "CREATE TABLE table (id NUMBER)", - "WRONG SYNTAX", - "" + "SELECT * FROM table", + "DELETE FROM table WHERE id = 1", + "INSERT INTO table VALUES(1)", + "UPDATE table SET id = 1", + "DROP TABLE table", + "CREATE TABLE table (id NUMBER)", + "ALTER TABLE table ADD (col1 NUMBER)", + "BEGIN NULL; END;", + "DECLARE myn NUMBER BEGIN myn := 1; END;", + "CALL myproc(1)", + "WRONG SYNTAX", + "" ); foreach ($sqls as $sql) { @@ -34,24 +31,30 @@ echo "Done\n"; ?> --EXPECTF-- -resource(%d) of type (oci8 connection) string(6) "SELECT" string(6) "DELETE" string(6) "INSERT" string(6) "UPDATE" string(4) "DROP" string(6) "CREATE" +string(5) "ALTER" +string(5) "BEGIN" +string(7) "DECLARE" +string(4) "CALL" string(7) "UNKNOWN" string(7) "UNKNOWN" Done --UEXPECTF-- -resource(%d) of type (oci8 connection) unicode(6) "SELECT" unicode(6) "DELETE" unicode(6) "INSERT" unicode(6) "UPDATE" unicode(4) "DROP" unicode(6) "CREATE" +unicode(5) "ALTER" +unicode(5) "BEGIN" +unicode(7) "DECLARE" +unicode(4) "CALL" unicode(7) "UNKNOWN" unicode(7) "UNKNOWN" Done