From: Georg Richter Date: Sun, 19 Nov 2006 12:14:44 +0000 (+0000) Subject: added testcases for ext/mysql (written by Ulf Wendel) X-Git-Tag: RELEASE_1_0_0RC1~971 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cdd3e8be92002a22a824089a3d831286e26a0fe8;p=php added testcases for ext/mysql (written by Ulf Wendel) --- diff --git a/ext/mysql/tests/mysql_affected_rows.phpt b/ext/mysql/tests/mysql_affected_rows.phpt new file mode 100644 index 0000000000..2b4206513f --- /dev/null +++ b/ext/mysql/tests/mysql_affected_rows.phpt @@ -0,0 +1,114 @@ +--TEST-- +mysql_affected_rows() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_client_encoding.phpt b/ext/mysql/tests/mysql_client_encoding.phpt new file mode 100644 index 0000000000..7df38a4abb --- /dev/null +++ b/ext/mysql/tests/mysql_client_encoding.phpt @@ -0,0 +1,68 @@ +--TEST-- +mysql_client_encoding() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +done! diff --git a/ext/mysql/tests/mysql_close.phpt b/ext/mysql/tests/mysql_close.phpt new file mode 100644 index 0000000000..1bf5e52081 --- /dev/null +++ b/ext/mysql/tests/mysql_close.phpt @@ -0,0 +1,39 @@ +--TEST-- +mysql_close() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_connect.phpt b/ext/mysql/tests/mysql_connect.phpt new file mode 100644 index 0000000000..b2507d6a2b --- /dev/null +++ b/ext/mysql/tests/mysql_connect.phpt @@ -0,0 +1,72 @@ +--TEST-- +mysql_connect() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: mysql_connect(): Access denied for user '%s'@'%s' (using password: YES) in %s on line %d +done! diff --git a/ext/mysql/tests/mysql_create_db.phpt b/ext/mysql/tests/mysql_create_db.phpt new file mode 100644 index 0000000000..bf633e3e5e --- /dev/null +++ b/ext/mysql/tests/mysql_create_db.phpt @@ -0,0 +1,44 @@ +--TEST-- +mysql_create_db() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +done! diff --git a/ext/mysql/tests/mysql_data_seek.phpt b/ext/mysql/tests/mysql_data_seek.phpt new file mode 100644 index 0000000000..ab83824736 --- /dev/null +++ b/ext/mysql/tests/mysql_data_seek.phpt @@ -0,0 +1,71 @@ +--TEST-- +mysql_data_seek() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: mysql_data_seek(): Offset 4 is invalid for MySQL result index %d (or the query data is unbuffered) in %s on line %d + +Warning: mysql_data_seek(): Offset -1 is invalid for MySQL result index %d (or the query data is unbuffered) in %s on line %d + +Warning: mysql_data_seek(): Offset 3 is invalid for MySQL result index %d (or the query data is unbuffered) in %s on line %d + +Warning: mysql_data_seek(): %d is not a valid MySQL result resource in %s on line %d +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_db_name.phpt b/ext/mysql/tests/mysql_db_name.phpt new file mode 100644 index 0000000000..4c12cc1d3b --- /dev/null +++ b/ext/mysql/tests/mysql_db_name.phpt @@ -0,0 +1,65 @@ +--TEST-- +mysql_db_name() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: mysql_db_name(): Unable to jump to row -1 on MySQL result index %d in %s on line %d + +Warning: mysql_db_name(): Unable to jump to row %d on MySQL result index %d in %s on line %d + +Warning: mysql_db_name(): %d is not a valid MySQL result resource in %s on line %d +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_db_query.phpt b/ext/mysql/tests/mysql_db_query.phpt new file mode 100644 index 0000000000..42698b9268 --- /dev/null +++ b/ext/mysql/tests/mysql_db_query.phpt @@ -0,0 +1,43 @@ +--TEST-- +mysql_db_query() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_drop_db.phpt b/ext/mysql/tests/mysql_drop_db.phpt new file mode 100644 index 0000000000..8a59d1bd85 --- /dev/null +++ b/ext/mysql/tests/mysql_drop_db.phpt @@ -0,0 +1,43 @@ +--TEST-- +mysql_drop_db() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +done! diff --git a/ext/mysql/tests/mysql_errno.phpt b/ext/mysql/tests/mysql_errno.phpt new file mode 100644 index 0000000000..8284144c16 --- /dev/null +++ b/ext/mysql/tests/mysql_errno.phpt @@ -0,0 +1,45 @@ +--TEST-- +mysql_errno() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +int(0) +int(%d) + +Warning: mysql_errno(): %d is not a valid MySQL-Link resource in %s on line %d +bool(false) +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_error.phpt b/ext/mysql/tests/mysql_error.phpt new file mode 100644 index 0000000000..3b71e22146 --- /dev/null +++ b/ext/mysql/tests/mysql_error.phpt @@ -0,0 +1,51 @@ +--TEST-- +mysql_error() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: mysql_error(): %d is not a valid MySQL-Link resource in %s on line %d +bool(false) +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_escape_string.phpt b/ext/mysql/tests/mysql_escape_string.phpt new file mode 100644 index 0000000000..027b52e982 --- /dev/null +++ b/ext/mysql/tests/mysql_escape_string.phpt @@ -0,0 +1,44 @@ +--TEST-- +mysql_escape_string() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +string(31) "Am I a unicode string in PHP 6?" +string(2) "\\" +string(2) "\"" +string(2) "\'" +string(2) "\n" +string(2) "\r" +string(8) "foo\0bar" +done! +--UEXPECTF-- +unicode(31) "Am I a unicode string in PHP 6?" +unicode(2) "\\" +unicode(2) "\"" +unicode(2) "\'" +unicode(2) "\n" +unicode(2) "\r" +unicode(8) "foo\0bar" +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_fetch_array.phpt b/ext/mysql/tests/mysql_fetch_array.phpt new file mode 100644 index 0000000000..825a74c3d9 --- /dev/null +++ b/ext/mysql/tests/mysql_fetch_array.phpt @@ -0,0 +1,419 @@ +--TEST-- +mysql_fetch_array() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +[005] +array(4) { + [0]=> + string(1) "1" + ["id"]=> + string(1) "1" + [1]=> + string(1) "a" + ["label"]=> + string(1) "a" +} +[006] +array(2) { + [0]=> + string(1) "2" + [1]=> + string(1) "b" +} +[007] +array(4) { + [0]=> + string(1) "3" + ["id"]=> + string(1) "3" + [1]=> + string(1) "c" + ["label"]=> + string(1) "c" +} +[008] +array(2) { + ["id"]=> + string(1) "4" + ["label"]=> + string(1) "d" +} +[009] +array(4) { + [0]=> + string(1) "5" + ["id"]=> + string(1) "5" + [1]=> + string(1) "e" + ["label"]=> + string(1) "e" +} +[011] +array(11) { + [0]=> + string(1) "1" + ["a"]=> + string(1) "2" + [1]=> + string(1) "2" + [2]=> + string(1) "3" + ["c"]=> + string(1) "3" + [3]=> + string(1) "4" + ["C"]=> + string(1) "4" + [4]=> + NULL + ["d"]=> + NULL + [5]=> + string(1) "1" + ["e"]=> + string(1) "1" +} + +Warning: mysql_fetch_array(): %d is not a valid MySQL result resource in %s on line %d +done! +--UEXPECTF-- +[005] +array(4) { + [0]=> + unicode(1) "1" + [u"id"]=> + unicode(1) "1" + [1]=> + unicode(1) "a" + [u"label"]=> + unicode(1) "a" +} +[006] +array(2) { + [0]=> + unicode(1) "2" + [1]=> + unicode(1) "b" +} +[007] +array(4) { + [0]=> + unicode(1) "3" + [u"id"]=> + unicode(1) "3" + [1]=> + unicode(1) "c" + [u"label"]=> + unicode(1) "c" +} +[008] +array(2) { + [u"id"]=> + unicode(1) "4" + [u"label"]=> + unicode(1) "d" +} +[009] +array(4) { + [0]=> + unicode(1) "5" + [u"id"]=> + unicode(1) "5" + [1]=> + unicode(1) "e" + [u"label"]=> + unicode(1) "e" +} +[011] +array(11) { + [0]=> + unicode(1) "1" + [u"a"]=> + unicode(1) "2" + [1]=> + unicode(1) "2" + [2]=> + unicode(1) "3" + [u"c"]=> + unicode(1) "3" + [3]=> + unicode(1) "4" + [u"C"]=> + unicode(1) "4" + [4]=> + NULL + [u"d"]=> + NULL + [5]=> + unicode(1) "1" + [u"e"]=> + unicode(1) "1" +} + +Warning: mysql_fetch_array(): %d is not a valid MySQL result resource in %s on line %d +done! diff --git a/ext/mysql/tests/mysql_fetch_assoc.phpt b/ext/mysql/tests/mysql_fetch_assoc.phpt new file mode 100644 index 0000000000..9a4de686f8 --- /dev/null +++ b/ext/mysql/tests/mysql_fetch_assoc.phpt @@ -0,0 +1,100 @@ +--TEST-- +mysql_fetch_assoc() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +[005] +array(2) { + ["id"]=> + string(1) "1" + ["label"]=> + string(1) "a" +} +[006] +bool(false) +[008] +array(5) { + ["a"]=> + string(1) "2" + ["c"]=> + string(1) "3" + ["C"]=> + string(1) "4" + ["d"]=> + NULL + ["e"]=> + string(1) "1" +} + +Warning: mysql_fetch_assoc(): %d is not a valid MySQL result resource in %s on line %d +done! +--UEXPECTF-- +[005] +array(2) { + [u"id"]=> + unicode(1) "1" + [u"label"]=> + unicode(1) "a" +} +[006] +bool(false) +[008] +array(5) { + [u"a"]=> + unicode(1) "2" + [u"c"]=> + unicode(1) "3" + [u"C"]=> + unicode(1) "4" + [u"d"]=> + NULL + [u"e"]=> + unicode(1) "1" +} + +Warning: mysql_fetch_assoc(): %d is not a valid MySQL result resource in %s on line %d +done! diff --git a/ext/mysql/tests/mysql_fetch_field.phpt b/ext/mysql/tests/mysql_fetch_field.phpt new file mode 100644 index 0000000000..cfd0a42b8b --- /dev/null +++ b/ext/mysql/tests/mysql_fetch_field.phpt @@ -0,0 +1,158 @@ +--TEST-- +mysql_fetch_field() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +object(stdClass)#%d (13) { + ["name"]=> + string(2) "ID" + ["table"]=> + string(4) "TEST" + ["def"]=> + string(0) "" + ["max_length"]=> + int(1) + ["not_null"]=> + int(1) + ["primary_key"]=> + int(1) + ["multiple_key"]=> + int(0) + ["unique_key"]=> + int(0) + ["numeric"]=> + int(1) + ["blob"]=> + int(0) + ["type"]=> + string(3) "int" + ["unsigned"]=> + int(0) + ["zerofill"]=> + int(0) +} +object(stdClass)#%d (13) { + ["name"]=> + string(5) "label" + ["table"]=> + string(4) "TEST" + ["def"]=> + string(0) "" + ["max_length"]=> + int(1) + ["not_null"]=> + int(0) + ["primary_key"]=> + int(0) + ["multiple_key"]=> + int(0) + ["unique_key"]=> + int(0) + ["numeric"]=> + int(0) + ["blob"]=> + int(0) + ["type"]=> + string(6) "string" + ["unsigned"]=> + int(0) + ["zerofill"]=> + int(0) +} +bool(false) + +Warning: mysql_fetch_field(): %d is not a valid MySQL result resource in %s on line %d +done! +--UEXPECTF-- +object(stdClass)#%d (13) { + [u"name"]=> + unicode(2) "ID" + [u"table"]=> + unicode(4) "TEST" + [u"def"]=> + unicode(0) "" + [u"max_length"]=> + int(1) + [u"not_null"]=> + int(1) + [u"primary_key"]=> + int(1) + [u"multiple_key"]=> + int(0) + [u"unique_key"]=> + int(0) + [u"numeric"]=> + int(1) + [u"blob"]=> + int(0) + [u"type"]=> + unicode(3) "int" + [u"unsigned"]=> + int(0) + [u"zerofill"]=> + int(0) +} +object(stdClass)#%d (13) { + [u"name"]=> + unicode(5) "label" + [u"table"]=> + unicode(4) "TEST" + [u"def"]=> + unicode(0) "" + [u"max_length"]=> + int(1) + [u"not_null"]=> + int(0) + [u"primary_key"]=> + int(0) + [u"multiple_key"]=> + int(0) + [u"unique_key"]=> + int(0) + [u"numeric"]=> + int(0) + [u"blob"]=> + int(0) + [u"type"]=> + unicode(6) "string" + [u"unsigned"]=> + int(0) + [u"zerofill"]=> + int(0) +} +bool(false) + +Warning: mysql_fetch_field(): %d is not a valid MySQL result resource in %s on line %d +done! diff --git a/ext/mysql/tests/mysql_fetch_lengths.phpt b/ext/mysql/tests/mysql_fetch_lengths.phpt new file mode 100644 index 0000000000..4fd14b24c5 --- /dev/null +++ b/ext/mysql/tests/mysql_fetch_lengths.phpt @@ -0,0 +1,46 @@ +--TEST-- +mysql_fetch_lengths() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +array(2) { + [0]=> + int(1) + [1]=> + int(1) +} +bool(false) + +Warning: mysql_fetch_lengths(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_fetch_object.phpt b/ext/mysql/tests/mysql_fetch_object.phpt new file mode 100644 index 0000000000..d2e772062f --- /dev/null +++ b/ext/mysql/tests/mysql_fetch_object.phpt @@ -0,0 +1,200 @@ +--TEST-- +mysql_fetch_object() +--SKIPIF-- + + +--FILE-- +a = $a; + $this->b = $b; + } + + } + + var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', null)); + var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a'))); + var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a', 'b'))); + var_dump(mysql_fetch_object($res, 'mysql_fetch_object_construct', array('a', 'b', 'c'))); + var_dump(mysql_fetch_object($res)); + + mysql_free_result($res); + + if (!$res = mysql_query("SELECT id AS ID, label FROM test AS TEST", $link)) { + printf("[009] [%d] %s\n", mysql_errno($link), mysql_error($link)); + } + + mysql_free_result($res); + + var_dump(mysql_fetch_object($res)); + + // Fatal error, script execution will end + var_dump(mysql_fetch_object($res, 'this_class_does_not_exist')); + + mysql_close($link); + print "done!"; +?> +--EXPECTF-- +object(stdClass)#%d (2) { + ["ID"]=> + string(1) "1" + ["label"]=> + string(1) "a" +} +object(mysql_fetch_object_test)#%d (4) { + ["a"]=> + NULL + ["b"]=> + NULL + ["ID"]=> + string(1) "2" + ["label"]=> + string(1) "b" +} + +Warning: Missing argument 1 for mysql_fetch_object_construct::__construct() in %s on line %d + +Warning: Missing argument 2 for mysql_fetch_object_construct::__construct() in %s on line %d + +Notice: Undefined variable: a in %s on line %d + +Notice: Undefined variable: b in %s on line %d +object(mysql_fetch_object_construct)#1 (4) { + ["a"]=> + NULL + ["b"]=> + NULL + ["ID"]=> + string(1) "3" + ["label"]=> + string(1) "c" +} + +Warning: Missing argument 2 for mysql_fetch_object_construct::__construct() in %s on line %d + +Notice: Undefined variable: b in %s on line %d +object(mysql_fetch_object_construct)#1 (4) { + ["a"]=> + string(1) "a" + ["b"]=> + NULL + ["ID"]=> + string(1) "4" + ["label"]=> + string(1) "d" +} +object(mysql_fetch_object_construct)#1 (4) { + ["a"]=> + string(1) "a" + ["b"]=> + string(1) "b" + ["ID"]=> + string(1) "5" + ["label"]=> + string(1) "e" +} +bool(false) +bool(false) + +Warning: mysql_fetch_object(): %d is not a valid MySQL result resource in %s on line %d +bool(false) + +Fatal error: Class 'this_class_does_not_exist' not found in %s on line %d +--UEXPECTF-- +object(stdClass)#%d (2) { + [u"ID"]=> + unicode(1) "1" + [u"label"]=> + unicode(1) "a" +} +object(mysql_fetch_object_test)#%d (4) { + [u"a"]=> + NULL + [u"b"]=> + NULL + [u"ID"]=> + unicode(1) "2" + [u"label"]=> + unicode(1) "b" +} + +Warning: Missing argument 1 for mysql_fetch_object_construct::__construct() in %s on line %d + +Warning: Missing argument 2 for mysql_fetch_object_construct::__construct() in %s on line %d + +Notice: Undefined variable: a in %s on line %d + +Notice: Undefined variable: b in %s on line %d +object(mysql_fetch_object_construct)#1 (4) { + [u"a"]=> + NULL + [u"b"]=> + NULL + [u"ID"]=> + unicode(1) "3" + [u"label"]=> + unicode(1) "c" +} + +Warning: Missing argument 2 for mysql_fetch_object_construct::__construct() in %s on line %d + +Notice: Undefined variable: b in %s on line %d +object(mysql_fetch_object_construct)#1 (4) { + [u"a"]=> + unicode(1) "a" + [u"b"]=> + NULL + [u"ID"]=> + unicode(1) "4" + [u"label"]=> + unicode(1) "d" +} +object(mysql_fetch_object_construct)#1 (4) { + [u"a"]=> + unicode(1) "a" + [u"b"]=> + unicode(1) "b" + [u"ID"]=> + unicode(1) "5" + [u"label"]=> + unicode(1) "e" +} +bool(false) +bool(false) + +Warning: mysql_fetch_object(): %d is not a valid MySQL result resource in %s on line %d +bool(false) + +Fatal error: Class 'this_class_does_not_exist' not found in %s on line %d diff --git a/ext/mysql/tests/mysql_fetch_row.phpt b/ext/mysql/tests/mysql_fetch_row.phpt new file mode 100644 index 0000000000..9909adcc51 --- /dev/null +++ b/ext/mysql/tests/mysql_fetch_row.phpt @@ -0,0 +1,78 @@ +--TEST-- +mysql_fetch_row() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +[004] +array(2) { + [0]=> + string(1) "1" + [1]=> + string(1) "a" +} +[005] +bool(false) + +Warning: mysql_fetch_row(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! +--EXPECTF-- +[004] +array(2) { + [0]=> + string(1) "1" + [1]=> + string(1) "a" +} +[005] +bool(false) + +Warning: mysql_fetch_row(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! +--UEXPECTF-- +[004] +array(2) { + [0]=> + unicode(1) "1" + [1]=> + unicode(1) "a" +} +[005] +bool(false) + +Warning: mysql_fetch_row(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_field_flags.phpt b/ext/mysql/tests/mysql_field_flags.phpt new file mode 100644 index 0000000000..b2f2deeda0 --- /dev/null +++ b/ext/mysql/tests/mysql_field_flags.phpt @@ -0,0 +1,57 @@ +--TEST-- +mysql_field_flags() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for mysql_field_flags() in %s on line %d + +Warning: mysql_field_flags(): Field -1 is invalid for MySQL result index %d in %s on line %d + +Warning: mysql_field_flags(): Field 2 is invalid for MySQL result index %d in %s on line %d + +Warning: mysql_field_flags(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! diff --git a/ext/mysql/tests/mysql_field_len.phpt b/ext/mysql/tests/mysql_field_len.phpt new file mode 100644 index 0000000000..44c45883fc --- /dev/null +++ b/ext/mysql/tests/mysql_field_len.phpt @@ -0,0 +1,52 @@ +--TEST-- +mysql_field_len() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for mysql_field_len() in %s on line %d + +Warning: mysql_field_len(): Field -1 is invalid for MySQL result index %d in %s on line %d + +Warning: mysql_field_len(): Field 2 is invalid for MySQL result index %d in %s on line %d + +Warning: mysql_field_len(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_field_name.phpt b/ext/mysql/tests/mysql_field_name.phpt new file mode 100644 index 0000000000..569176be94 --- /dev/null +++ b/ext/mysql/tests/mysql_field_name.phpt @@ -0,0 +1,63 @@ +--TEST-- +mysql_field_name() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for mysql_field_name() in %s on line %d + +Warning: mysql_field_name(): Field -1 is invalid for MySQL result index %d in %s on line %d +string(2) "id" + +Warning: mysql_field_name(): Field 2 is invalid for MySQL result index %d in %s on line %d + +Warning: mysql_field_name(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! +--UEXPECTF-- +Warning: Wrong parameter count for mysql_field_name() in %s on line %d + +Warning: mysql_field_name(): Field -1 is invalid for MySQL result index %d in %s on line %d +unicode(2) "id" + +Warning: mysql_field_name(): Field 2 is invalid for MySQL result index %d in %s on line %d + +Warning: mysql_field_name(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_field_seek.phpt b/ext/mysql/tests/mysql_field_seek.phpt new file mode 100644 index 0000000000..c5a40dbb90 --- /dev/null +++ b/ext/mysql/tests/mysql_field_seek.phpt @@ -0,0 +1,233 @@ +--TEST-- +mysql_field_seek() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: mysql_field_seek(): Field -1 is invalid for MySQL result index %d in %s on line %d +bool(false) +object(stdClass)#%d (13) { + ["name"]=> + string(2) "id" + ["table"]=> + string(4) "test" + ["def"]=> + string(0) "" + ["max_length"]=> + int(1) + ["not_null"]=> + int(1) + ["primary_key"]=> + int(1) + ["multiple_key"]=> + int(0) + ["unique_key"]=> + int(0) + ["numeric"]=> + int(1) + ["blob"]=> + int(0) + ["type"]=> + string(3) "int" + ["unsigned"]=> + int(0) + ["zerofill"]=> + int(0) +} +bool(true) +object(stdClass)#%d (13) { + ["name"]=> + string(2) "id" + ["table"]=> + string(4) "test" + ["def"]=> + string(0) "" + ["max_length"]=> + int(1) + ["not_null"]=> + int(1) + ["primary_key"]=> + int(1) + ["multiple_key"]=> + int(0) + ["unique_key"]=> + int(0) + ["numeric"]=> + int(1) + ["blob"]=> + int(0) + ["type"]=> + string(3) "int" + ["unsigned"]=> + int(0) + ["zerofill"]=> + int(0) +} +bool(true) +object(stdClass)#%d (13) { + ["name"]=> + string(5) "label" + ["table"]=> + string(4) "test" + ["def"]=> + string(0) "" + ["max_length"]=> + int(1) + ["not_null"]=> + int(0) + ["primary_key"]=> + int(0) + ["multiple_key"]=> + int(0) + ["unique_key"]=> + int(0) + ["numeric"]=> + int(0) + ["blob"]=> + int(0) + ["type"]=> + string(6) "string" + ["unsigned"]=> + int(0) + ["zerofill"]=> + int(0) +} + +Warning: mysql_field_seek(): Field %d is invalid for MySQL result index %d in %s on line %d +bool(false) +bool(false) + +Warning: mysql_field_seek(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! +--UEXPECTF-- +Warning: mysql_field_seek(): Field -1 is invalid for MySQL result index %d in %s on line %d +bool(false) +object(stdClass)#%d (13) { + [u"name"]=> + unicode(2) "id" + [u"table"]=> + unicode(4) "test" + [u"def"]=> + unicode(0) "" + [u"max_length"]=> + int(1) + [u"not_null"]=> + int(1) + [u"primary_key"]=> + int(1) + [u"multiple_key"]=> + int(0) + [u"unique_key"]=> + int(0) + [u"numeric"]=> + int(1) + [u"blob"]=> + int(0) + [u"type"]=> + unicode(3) "int" + [u"unsigned"]=> + int(0) + [u"zerofill"]=> + int(0) +} +bool(true) +object(stdClass)#%d (13) { + [u"name"]=> + unicode(2) "id" + [u"table"]=> + unicode(4) "test" + [u"def"]=> + unicode(0) "" + [u"max_length"]=> + int(1) + [u"not_null"]=> + int(1) + [u"primary_key"]=> + int(1) + [u"multiple_key"]=> + int(0) + [u"unique_key"]=> + int(0) + [u"numeric"]=> + int(1) + [u"blob"]=> + int(0) + [u"type"]=> + unicode(3) "int" + [u"unsigned"]=> + int(0) + [u"zerofill"]=> + int(0) +} +bool(true) +object(stdClass)#%d (13) { + [u"name"]=> + unicode(5) "label" + [u"table"]=> + unicode(4) "test" + [u"def"]=> + unicode(0) "" + [u"max_length"]=> + int(1) + [u"not_null"]=> + int(0) + [u"primary_key"]=> + int(0) + [u"multiple_key"]=> + int(0) + [u"unique_key"]=> + int(0) + [u"numeric"]=> + int(0) + [u"blob"]=> + int(0) + [u"type"]=> + unicode(6) "string" + [u"unsigned"]=> + int(0) + [u"zerofill"]=> + int(0) +} + +Warning: mysql_field_seek(): Field %d is invalid for MySQL result index %d in %s on line %d +bool(false) +bool(false) + +Warning: mysql_field_seek(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! diff --git a/ext/mysql/tests/mysql_field_table.phpt b/ext/mysql/tests/mysql_field_table.phpt new file mode 100644 index 0000000000..3ee4724d67 --- /dev/null +++ b/ext/mysql/tests/mysql_field_table.phpt @@ -0,0 +1,63 @@ +--TEST-- +mysql_field_table() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for mysql_field_table() in %s on line %d + +Warning: mysql_field_table(): Field -1 is invalid for MySQL result index %d in %s on line %d +string(4) "test" + +Warning: mysql_field_table(): Field 2 is invalid for MySQL result index %d in %s on line %d + +Warning: mysql_field_table(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! +--UEXPECTF-- +Warning: Wrong parameter count for mysql_field_table() in %s on line %d + +Warning: mysql_field_table(): Field -1 is invalid for MySQL result index %d in %s on line %d +unicode(4) "test" + +Warning: mysql_field_table(): Field 2 is invalid for MySQL result index %d in %s on line %d + +Warning: mysql_field_table(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_field_type.phpt b/ext/mysql/tests/mysql_field_type.phpt new file mode 100644 index 0000000000..702ff614d2 --- /dev/null +++ b/ext/mysql/tests/mysql_field_type.phpt @@ -0,0 +1,63 @@ +--TEST-- +mysql_field_type() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for mysql_field_type() in %s on line %d + +Warning: mysql_field_type(): Field -1 is invalid for MySQL result index %d in %s on line %d +string(3) "int" + +Warning: mysql_field_type(): Field 2 is invalid for MySQL result index %d in %s on line %d + +Warning: mysql_field_type(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! +--UEXPECTF-- +Warning: Wrong parameter count for mysql_field_type() in %s on line %d + +Warning: mysql_field_type(): Field -1 is invalid for MySQL result index %d in %s on line %d +unicode(3) "int" + +Warning: mysql_field_type(): Field 2 is invalid for MySQL result index %d in %s on line %d + +Warning: mysql_field_type(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_free_result.phpt b/ext/mysql/tests/mysql_free_result.phpt new file mode 100644 index 0000000000..77b32ee8ca --- /dev/null +++ b/ext/mysql/tests/mysql_free_result.phpt @@ -0,0 +1,35 @@ +--TEST-- +mysql_free_result() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +bool(true) + +Warning: mysql_free_result(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_get_client_info.phpt b/ext/mysql/tests/mysql_get_client_info.phpt new file mode 100644 index 0000000000..7d4eecde26 --- /dev/null +++ b/ext/mysql/tests/mysql_get_client_info.phpt @@ -0,0 +1,20 @@ +--TEST-- +mysql_get_client_info() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_get_host_info.phpt b/ext/mysql/tests/mysql_get_host_info.phpt new file mode 100644 index 0000000000..e6f5ee463c --- /dev/null +++ b/ext/mysql/tests/mysql_get_host_info.phpt @@ -0,0 +1,33 @@ +--TEST-- +mysql_get_host_info() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +done! diff --git a/ext/mysql/tests/mysql_get_proto_info.phpt b/ext/mysql/tests/mysql_get_proto_info.phpt new file mode 100644 index 0000000000..ae804a8801 --- /dev/null +++ b/ext/mysql/tests/mysql_get_proto_info.phpt @@ -0,0 +1,20 @@ +--TEST-- +mysql_get_proto_info() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +done! diff --git a/ext/mysql/tests/mysql_get_server_info.phpt b/ext/mysql/tests/mysql_get_server_info.phpt new file mode 100644 index 0000000000..0a633b7a60 --- /dev/null +++ b/ext/mysql/tests/mysql_get_server_info.phpt @@ -0,0 +1,34 @@ +--TEST-- +mysql_get_server_info() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +done! diff --git a/ext/mysql/tests/mysql_info.phpt b/ext/mysql/tests/mysql_info.phpt new file mode 100644 index 0000000000..46632e1792 --- /dev/null +++ b/ext/mysql/tests/mysql_info.phpt @@ -0,0 +1,67 @@ +--TEST-- +mysql_info() +--SKIPIF-- + + +--FILE-- += 100', $link)) + printf("[011] [%d] %s\n", mysql_errno($link), mysql_error($link)); + + if (!is_string($tmp = mysql_info($link)) || ('' == $tmp)) + printf("[012] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp); + + if (ini_get('unicode.semantics') && !is_unicode($tmp)) { + printf("[013] Expecting Unicode!\n"); + var_inspect($info); + } + + if (!is_string($def_tmp = mysql_info()) || ('' == $def_tmp)) + printf("[014] Expecting string/any_non_empty, got %s/%s\n", gettype($def_tmp), $def_tmp); + + if ($def_tmp !== $tmp) { + printf("[015] Results differ for default link and specified link, [%d] %s\n", + mysql_errno(), mysql_error()); + var_inspect($tmp); + var_inspect($def_tmp); + } + + // NOTE: no LOAD DATA INFILE test + + print "done!"; +?> +--EXPECTF-- +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_insert_id.phpt b/ext/mysql/tests/mysql_insert_id.phpt new file mode 100644 index 0000000000..ab648e8a01 --- /dev/null +++ b/ext/mysql/tests/mysql_insert_id.phpt @@ -0,0 +1,56 @@ +--TEST-- +mysql_insert_id() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: mysql_insert_id(): %d is not a valid MySQL-Link resource in %s on line %d +bool(false) +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_list_dbs.phpt b/ext/mysql/tests/mysql_list_dbs.phpt new file mode 100644 index 0000000000..6f8cacb1d4 --- /dev/null +++ b/ext/mysql/tests/mysql_list_dbs.phpt @@ -0,0 +1,38 @@ +--TEST-- +mysql_list_dbs() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +done! diff --git a/ext/mysql/tests/mysql_list_fields.phpt b/ext/mysql/tests/mysql_list_fields.phpt new file mode 100644 index 0000000000..5dbabf347d --- /dev/null +++ b/ext/mysql/tests/mysql_list_fields.phpt @@ -0,0 +1,30 @@ +--TEST-- +mysql_list_fields() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +done! diff --git a/ext/mysql/tests/mysql_list_processes.phpt b/ext/mysql/tests/mysql_list_processes.phpt new file mode 100644 index 0000000000..11e1d4ccda --- /dev/null +++ b/ext/mysql/tests/mysql_list_processes.phpt @@ -0,0 +1,35 @@ +--TEST-- +mysql_list_processes() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +done! diff --git a/ext/mysql/tests/mysql_num_fields.phpt b/ext/mysql/tests/mysql_num_fields.phpt new file mode 100644 index 0000000000..8de78fb027 --- /dev/null +++ b/ext/mysql/tests/mysql_num_fields.phpt @@ -0,0 +1,50 @@ +--TEST-- +mysql_num_fields() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: mysql_num_fields(): %d is not a valid MySQL result resource in %s on line %d +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_num_rows.phpt b/ext/mysql/tests/mysql_num_rows.phpt new file mode 100644 index 0000000000..978afa9801 --- /dev/null +++ b/ext/mysql/tests/mysql_num_rows.phpt @@ -0,0 +1,65 @@ +--TEST-- +mysql_num_rows() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in %s on line %d + +Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in %s on line %d + +Warning: mysql_num_rows(): %d is not a valid MySQL result resource in %s on line %d +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_pconnect.phpt b/ext/mysql/tests/mysql_pconnect.phpt new file mode 100644 index 0000000000..321683046b --- /dev/null +++ b/ext/mysql/tests/mysql_pconnect.phpt @@ -0,0 +1,74 @@ +--TEST-- +mysql_pconnect() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: mysql_pconnect(): Access denied for user '%s'@'%s' (using password: YES) in %s on line %d +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_ping.phpt b/ext/mysql/tests/mysql_ping.phpt new file mode 100644 index 0000000000..09eae647a2 --- /dev/null +++ b/ext/mysql/tests/mysql_ping.phpt @@ -0,0 +1,40 @@ +--TEST-- +mysql_ping() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +bool(true) +bool(true) + +Warning: mysql_ping(): %d is not a valid MySQL-Link resource in %s on line %d +done! diff --git a/ext/mysql/tests/mysql_query.phpt b/ext/mysql/tests/mysql_query.phpt new file mode 100644 index 0000000000..44b5c53b9c --- /dev/null +++ b/ext/mysql/tests/mysql_query.phpt @@ -0,0 +1,101 @@ +--TEST-- +mysql_query() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +array(1) { + ["valid"]=> + string(30) "this is sql but with semicolon" +} +array(1) { + ["p_version"]=> + string(%d) "%s" +} +array(1) { + ["f_version"]=> + string(%d) "%s" +} + +Warning: mysql_query(): %d is not a valid MySQL-Link resource in %s on line %d +done! +--UEXPECTF-- +array(1) { + [u"valid"]=> + unicode(30) "this is sql but with semicolon" +} +array(1) { + [u"p_version"]=> + unicode(%d) "%s" +} +array(1) { + [u"f_version"]=> + unicode(%d) "%s" +} + +Warning: mysql_query(): %d is not a valid MySQL-Link resource in %s on line %d +done! diff --git a/ext/mysql/tests/mysql_real_escape_string.phpt b/ext/mysql/tests/mysql_real_escape_string.phpt new file mode 100644 index 0000000000..7d3f957cb2 --- /dev/null +++ b/ext/mysql/tests/mysql_real_escape_string.phpt @@ -0,0 +1,45 @@ +--TEST-- +mysql_real_escape_string() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +string(31) "Am I a unicode string in PHP 6?" +string(2) "\\" +string(2) "\"" +string(2) "\'" +string(2) "\n" +string(2) "\r" +string(8) "foo\0bar" +done! +--UEXPECTF-- +unicode(31) "Am I a unicode string in PHP 6?" +unicode(2) "\\" +unicode(2) "\"" +unicode(2) "\'" +unicode(2) "\n" +unicode(2) "\r" +unicode(8) "foo\0bar" +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_result.phpt b/ext/mysql/tests/mysql_result.phpt new file mode 100644 index 0000000000..ec6e6b20e1 --- /dev/null +++ b/ext/mysql/tests/mysql_result.phpt @@ -0,0 +1,76 @@ +--TEST-- +mysql_result() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: mysql_result(): Unable to jump to row -1 on MySQL result index %d in %s on line %d +bool(false) + +Warning: mysql_result(): Unable to jump to row 2 on MySQL result index %d in %s on line %d +bool(false) + +Warning: mysql_result(): Bad column offset specified in %s on line %d +bool(false) + +Warning: mysql_result(): Bad column offset specified in %s on line %d +bool(false) +string(1) "1" +string(1) "a" + +Warning: mysql_result(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! +--UEXPECTF-- +Warning: mysql_result(): Unable to jump to row -1 on MySQL result index %d in %s on line %d +bool(false) + +Warning: mysql_result(): Unable to jump to row 2 on MySQL result index %d in %s on line %d +bool(false) + +Warning: mysql_result(): Bad column offset specified in %s on line %d +bool(false) + +Warning: mysql_result(): Bad column offset specified in %s on line %d +bool(false) +unicode(1) "1" +unicode(1) "a" + +Warning: mysql_result(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_select_db.phpt b/ext/mysql/tests/mysql_select_db.phpt new file mode 100644 index 0000000000..f635f94603 --- /dev/null +++ b/ext/mysql/tests/mysql_select_db.phpt @@ -0,0 +1,76 @@ +--TEST-- +mysql_select_db() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +string(7) "phptest" +bool(false) + +Warning: mysql_select_db(): %d is not a valid MySQL-Link resource in %s on line %d +done! +--UEXPECTF-- +unicode(7) "phptest" +bool(false) + +Warning: mysql_select_db(): %d is not a valid MySQL-Link resource in %s on line %d +done! diff --git a/ext/mysql/tests/mysql_stat.phpt b/ext/mysql/tests/mysql_stat.phpt new file mode 100644 index 0000000000..e3962ade86 --- /dev/null +++ b/ext/mysql/tests/mysql_stat.phpt @@ -0,0 +1,39 @@ +--TEST-- +mysql_stat() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: mysql_stat(): %d is not a valid MySQL-Link resource in %s on line %d +done! diff --git a/ext/mysql/tests/mysql_tablename.phpt b/ext/mysql/tests/mysql_tablename.phpt new file mode 100644 index 0000000000..c33757cc64 --- /dev/null +++ b/ext/mysql/tests/mysql_tablename.phpt @@ -0,0 +1,63 @@ +--TEST-- +mysql_tablename() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +Warning: Wrong parameter count for mysql_tablename() in %s on line %d + +Warning: mysql_tablename(): Unable to jump to row -1 on MySQL result index %d in %s on line %d +string(1) "1" + +Warning: mysql_tablename(): Unable to jump to row 2 on MySQL result index %d in %s on line %d + +Warning: mysql_tablename(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! +--UEXPECTF-- +Warning: Wrong parameter count for mysql_tablename() in %s on line %d + +Warning: mysql_tablename(): Unable to jump to row -1 on MySQL result index %d in %s on line %d +unicode(1) "1" + +Warning: mysql_tablename(): Unable to jump to row 2 on MySQL result index %d in %s on line %d + +Warning: mysql_tablename(): %d is not a valid MySQL result resource in %s on line %d +bool(false) +done! \ No newline at end of file diff --git a/ext/mysql/tests/mysql_thread_id.phpt b/ext/mysql/tests/mysql_thread_id.phpt new file mode 100644 index 0000000000..a1eea70c61 --- /dev/null +++ b/ext/mysql/tests/mysql_thread_id.phpt @@ -0,0 +1,30 @@ +--TEST-- +mysql_thread_id() +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +Warning: mysql_thread_id(): %d is not a valid MySQL-Link resource in %s on line %d +done! diff --git a/ext/mysql/tests/mysql_unbuffered_query.phpt b/ext/mysql/tests/mysql_unbuffered_query.phpt new file mode 100644 index 0000000000..37e0919701 --- /dev/null +++ b/ext/mysql/tests/mysql_unbuffered_query.phpt @@ -0,0 +1,112 @@ +--TEST-- +mysql_unbuffered_query() +--SKIPIF-- + + +--FILE-- + +--EXPECTF-- +array(1) { + ["valid"]=> + string(30) "this is sql but with semicolon" +} +array(1) { + ["p_version"]=> + string(16) "5.0.26-debug-log" +} +array(1) { + ["f_version"]=> + string(16) "5.0.26-debug-log" +} +bool(true) +resource(%d) of type (mysql result) +int(0) + +Notice: mysql_close(): Function called without first fetching all rows from a previous unbuffered query in %s on line %d + +Warning: mysql_unbuffered_query(): %d is not a valid MySQL-Link resource in %s on line %d +done! +--UEXPECTF-- +array(1) { + [u"valid"]=> + unicode(30) "this is sql but with semicolon" +} +array(1) { + [u"p_version"]=> + unicode(16) "5.0.26-debug-log" +} +array(1) { + [u"f_version"]=> + unicode(16) "5.0.26-debug-log" +} +bool(true) +resource(%d) of type (mysql result) +int(0) + +Notice: mysql_close(): Function called without first fetching all rows from a previous unbuffered query in %s on line %d + +Warning: mysql_unbuffered_query(): %d is not a valid MySQL-Link resource in %s on line %d +done! diff --git a/ext/mysql/tests/table.inc b/ext/mysql/tests/table.inc new file mode 100644 index 0000000000..5327f94f87 --- /dev/null +++ b/ext/mysql/tests/table.inc @@ -0,0 +1,24 @@ + \ No newline at end of file