From: Antony Dovgal Date: Wed, 27 Dec 2006 09:48:05 +0000 (+0000) Subject: more test improvements by Chris Jones X-Git-Tag: RELEASE_1_0_0RC1~487 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=06216846e713733410d8f50be1c30a5565d6d3e7;p=php more test improvements by Chris Jones --- diff --git a/ext/oci8/tests/details.inc b/ext/oci8/tests/details.inc index 6cf13ac72c..80f5bf8e4d 100644 --- a/ext/oci8/tests/details.inc +++ b/ext/oci8/tests/details.inc @@ -7,7 +7,7 @@ $user = "system"; $password = "system"; -$dbase = "oracle"; +$dbase = "HP"; /* Set this variable to TRUE if Oracle is installed @ localhost */ diff --git a/ext/oci8/tests/function_aliases.phpt b/ext/oci8/tests/function_aliases.phpt new file mode 100644 index 0000000000..4c6ce83759 --- /dev/null +++ b/ext/oci8/tests/function_aliases.phpt @@ -0,0 +1,198 @@ +--TEST-- +Existence of old function aliases +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: oci_free_cursor() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocifreecursor() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocibindbyname() expects at least 3 parameters, 0 given in %s on line %d +NULL + +Warning: ocidefinebyname() expects at least 3 parameters, 0 given in %s on line %d +NULL + +Warning: ocicolumnisnull() expects exactly 2 parameters, 0 given in %s on line %d +bool(false) + +Warning: ocicolumnname() expects exactly 2 parameters, 0 given in %s on line %d +bool(false) + +Warning: ocicolumnsize() expects exactly 2 parameters, 0 given in %s on line %d +bool(false) + +Warning: ocicolumnscale() expects exactly 2 parameters, 0 given in %s on line %d +bool(false) + +Warning: ocicolumnprecision() expects exactly 2 parameters, 0 given in %s on line %d +bool(false) + +Warning: ocicolumntype() expects exactly 2 parameters, 0 given in %s on line %d +bool(false) + +Warning: ocicolumntyperaw() expects exactly 2 parameters, 0 given in %s on line %d +bool(false) + +Warning: ociexecute() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocicancel() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocifetch() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocifetchstatement() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: ocifreestatement() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ociinternaldebug() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocinumcols() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ociparse() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: ocinewcursor() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ociresult() expects exactly 2 parameters, 0 given in %s on line %d +bool(false) + +Warning: ociserverversion() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocistatementtype() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocirowcount() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocilogoff() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocilogon() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: ocinlogon() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: ociplogon() expects at least 2 parameters, 0 given in %s on line %d +NULL +bool(false) + +Warning: ocifreedesc() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocisavelob() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: ocisavelobfile() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: ociwritelobtofile() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: ociloadlob() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocicommit() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocirollback() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocinewdescriptor() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocisetprefetch() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: Wrong parameter count for ocipasswordchange() in %s on line %d +NULL + +Warning: ocifreecollection() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocinewcollection() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: ocicollappend() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: ocicollgetelem() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: ocicollassignelem() expects exactly 3 parameters, 0 given in %s on line %d +NULL + +Warning: ocicollsize() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocicollmax() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocicolltrim() expects exactly 2 parameters, 0 given in %s on line %d +NULL +Done diff --git a/ext/oci8/tests/lob_aliases.phpt b/ext/oci8/tests/lob_aliases.phpt new file mode 100644 index 0000000000..faa59bf12d --- /dev/null +++ b/ext/oci8/tests/lob_aliases.phpt @@ -0,0 +1,99 @@ +--TEST-- +LOB method aliases +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Test 1 + +Warning: oci_lob_load() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: oci_lob_tell() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: oci_lob_truncate() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: oci_lob_erase() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: oci_lob_flush() expects at least 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocisetbufferinglob() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: ocigetbufferinglob() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: oci_lob_rewind() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: oci_lob_read() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: oci_lob_eof() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: oci_lob_seek() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: oci_lob_write() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: oci_lob_append() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: oci_lob_size() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: oci_lob_export() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: oci_lob_export() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: oci_lob_import() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: oci_lob_save() expects at least 2 parameters, 0 given in %s on line %d +NULL + +Warning: oci_lob_import() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +Warning: oci_free_descriptor() expects exactly 1 parameter, 0 given in %s on line %d +NULL +Done diff --git a/ext/oci8/tests/num.phpt b/ext/oci8/tests/num.phpt index 3c333b4e3a..458e3774f5 100644 --- a/ext/oci8/tests/num.phpt +++ b/ext/oci8/tests/num.phpt @@ -8,32 +8,117 @@ oci_num_*() family require dirname(__FILE__)."/connect.inc"; require dirname(__FILE__).'/create_table.inc'; +echo "Test 1\n"; +var_dump(ocirowcount()); +var_dump(oci_num_rows()); +var_dump(ocinumcols()); +var_dump(oci_num_fields()); + $insert_sql = "INSERT INTO ".$schema.$table_name." (id, value) VALUES (1,1)"; if (!($s = oci_parse($c, $insert_sql))) { - die("oci_parse(insert) failed!\n"); + die("oci_parse(insert) failed!\n"); } +echo "Test 2\n"; +var_dump(ocirowcount($s)); +var_dump(oci_num_rows($s)); +var_dump(ocinumcols($s)); +var_dump(oci_num_fields($s)); + for ($i = 0; $i<3; $i++) { - if (!oci_execute($s)) { - die("oci_execute(insert) failed!\n"); - } + if (!oci_execute($s)) { + die("oci_execute(insert) failed!\n"); + } } +echo "Test 3\n"; +var_dump(ocirowcount($s)); +var_dump(oci_num_rows($s)); +var_dump(ocinumcols($s)); +var_dump(oci_num_fields($s)); + if (!oci_commit($c)) { - die("oci_commit() failed!\n"); + die("oci_commit() failed!\n"); } +echo "Test 4\n"; +var_dump(ocirowcount($s)); +var_dump(oci_num_rows($s)); +var_dump(ocinumcols($s)); +var_dump(oci_num_fields($s)); + +// All rows $select_sql = "SELECT * FROM ".$schema.$table_name.""; if (!($s = oci_parse($c, $select_sql))) { - die("oci_parse(select) failed!\n"); + die("oci_parse(select) failed!\n"); +} + +echo "Test 5a\n"; +var_dump(ocirowcount($s)); +var_dump(oci_num_rows($s)); +var_dump(ocinumcols($s)); +var_dump(oci_num_fields($s)); + +if (!oci_execute($s)) { + die("oci_execute(select) failed!\n"); +} + +echo "Test 5b\n"; +var_dump(ocirowcount($s)); +var_dump(oci_num_rows($s)); +var_dump(ocinumcols($s)); +var_dump(oci_num_fields($s)); + + +if (oci_fetch_all($s,$r) === false) { + die("oci_fetch_all(select) failed!\n"); +} + +echo "Test 5c\n"; +var_dump(ocirowcount($s)); +var_dump(oci_num_rows($s)); +var_dump(ocinumcols($s)); +var_dump(oci_num_fields($s)); + +// One row +$select_sql = "SELECT id, value FROM ".$schema.$table_name." WHERE ROWNUM < 2"; + +if (!($s = oci_parse($c, $select_sql))) { + die("oci_parse(select) failed!\n"); +} + +if (!oci_execute($s)) { + die("oci_execute(select) failed!\n"); +} + +if (oci_fetch_all($s,$r) === false) { + die("oci_fetch_all(select) failed!\n"); +} + +echo "Test 6\n"; +var_dump(ocirowcount($s)); +var_dump(oci_num_rows($s)); +var_dump(ocinumcols($s)); +var_dump(oci_num_fields($s)); + +// No rows +$select_sql = "SELECT id FROM ".$schema.$table_name." WHERE 1=0"; + +if (!($s = oci_parse($c, $select_sql))) { + die("oci_parse(select) failed!\n"); } if (!oci_execute($s)) { - die("oci_execute(select) failed!\n"); + die("oci_execute(select) failed!\n"); +} + +if (oci_fetch_all($s,$r) === false) { + die("oci_fetch_all(select) failed!\n"); } +echo "Test 7\n"; var_dump(ocirowcount($s)); var_dump(oci_num_rows($s)); var_dump(ocinumcols($s)); @@ -48,19 +133,89 @@ if (!($s = oci_parse($c, $delete_sql))) { if (!oci_execute($s)) { die("oci_execute(delete) failed!\n"); } + +echo "Test 8a\n"; +var_dump(ocirowcount($s)); +var_dump(oci_num_rows($s)); +var_dump(ocinumcols($s)); +var_dump(oci_num_fields($s)); + + oci_commit($c); +echo "Test 8b\n"; +var_dump(ocirowcount($s)); var_dump(oci_num_rows($s)); +var_dump(ocinumcols($s)); +var_dump(oci_num_fields($s)); require dirname(__FILE__).'/drop_table.inc'; echo "Done\n"; ?> ---EXPECT-- +--EXPECTF-- +Test 1 + +Warning: ocirowcount() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: oci_num_rows() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: ocinumcols() expects exactly 1 parameter, 0 given in %s on line %d +NULL + +Warning: oci_num_fields() expects exactly 1 parameter, 0 given in %s on line %d +NULL +Test 2 +int(0) int(0) int(0) +int(0) +Test 3 +int(1) +int(1) +int(0) +int(0) +Test 4 +int(1) +int(1) +int(0) +int(0) +Test 5a +int(0) +int(0) +int(0) +int(0) +Test 5b +int(0) +int(0) +int(5) +int(5) +Test 5c +int(3) +int(3) int(5) int(5) +Test 6 +int(1) +int(1) +int(2) +int(2) +Test 7 +int(0) +int(0) +int(1) +int(1) +Test 8a +int(3) int(3) +int(0) +int(0) +Test 8b +int(3) +int(3) +int(0) +int(0) Done diff --git a/ext/oci8/tests/statement_type.phpt b/ext/oci8/tests/statement_type.phpt index 78e6570dc9..5964ac8cd8 100644 --- a/ext/oci8/tests/statement_type.phpt +++ b/ext/oci8/tests/statement_type.phpt @@ -12,7 +12,8 @@ $sqls = Array( "DELETE FROM table WHERE id = 1", "INSERT INTO table VALUES(1)", "UPDATE table SET id = 1", - "DROP TABLE table", + "DROP TABLE table", + "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;", "CREATE TABLE table (id NUMBER)", "ALTER TABLE table ADD (col1 NUMBER)", "BEGIN NULL; END;", @@ -37,6 +38,7 @@ string(6) "INSERT" string(6) "UPDATE" string(4) "DROP" string(6) "CREATE" +string(6) "CREATE" string(5) "ALTER" string(5) "BEGIN" string(7) "DECLARE" @@ -51,6 +53,7 @@ unicode(6) "INSERT" unicode(6) "UPDATE" unicode(4) "DROP" unicode(6) "CREATE" +unicode(6) "CREATE" unicode(5) "ALTER" unicode(5) "BEGIN" unicode(7) "DECLARE" diff --git a/ext/oci8/tests/statement_type_old.phpt b/ext/oci8/tests/statement_type_old.phpt index b594d3543e..03edc97f82 100644 --- a/ext/oci8/tests/statement_type_old.phpt +++ b/ext/oci8/tests/statement_type_old.phpt @@ -15,14 +15,19 @@ else { } $sqls = Array( - "SELECT * FROM table", - "DELETE FROM table WHERE id = 1", - "INSERT INTO table VALUES(1)", - "UPDATE table SET id = 1", + "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", - "" + "CREATE OR REPLACE PROCEDURE myproc(v1 NUMBER) as BEGIN DBMS_OUTPUT.PUT_LINE(v1); END;", + "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) { @@ -41,6 +46,11 @@ string(6) "INSERT" string(6) "UPDATE" string(4) "DROP" string(6) "CREATE" +string(6) "CREATE" +string(5) "ALTER" +string(5) "BEGIN" +string(7) "DECLARE" +string(4) "CALL" string(7) "UNKNOWN" string(7) "UNKNOWN" Done @@ -52,6 +62,11 @@ unicode(6) "INSERT" unicode(6) "UPDATE" unicode(4) "DROP" unicode(6) "CREATE" +unicode(6) "CREATE" +unicode(5) "ALTER" +unicode(5) "BEGIN" +unicode(7) "DECLARE" +unicode(4) "CALL" unicode(7) "UNKNOWN" unicode(7) "UNKNOWN" Done