From: Christopher Jones Date: Fri, 12 Mar 2010 00:27:57 +0000 (+0000) Subject: New and improved DBA tests X-Git-Tag: php-5.4.0alpha1~197^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=321ca32642fcfd68b5b89052239ff8139286ed10;p=php New and improved DBA tests --- diff --git a/ext/dba/tests/dba012.phpt b/ext/dba/tests/dba012.phpt new file mode 100644 index 0000000000..821c4e2aba --- /dev/null +++ b/ext/dba/tests/dba012.phpt @@ -0,0 +1,42 @@ +--TEST-- +DBA dba.default_handler tests +--SKIPIF-- + +--INI-- +dba.default_handler=flatfile +--FILE-- + +--CLEAN-- + +--EXPECTF-- +database handler: flatfile +Test 1 + +Warning: ini_set(): No such handler: does_not_exist in %sdba012.php on line %d +resource(%d) of type (dba) +Test 2 + +Warning: dba_open(%stest0.dbm,n): No default handler selected in %sdba012.php on line %d +bool(false) diff --git a/ext/dba/tests/dba013.phpt b/ext/dba/tests/dba013.phpt new file mode 100644 index 0000000000..bf95642e9d --- /dev/null +++ b/ext/dba/tests/dba013.phpt @@ -0,0 +1,27 @@ +--TEST-- +DBA with array key with empty array +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +database handler: %s + +Catchable fatal error: dba_insert(): Key does not have exactly two elements: (key, name) in %sdba013.php on line %d diff --git a/ext/dba/tests/dba014.phpt b/ext/dba/tests/dba014.phpt new file mode 100644 index 0000000000..7e52be7c3a --- /dev/null +++ b/ext/dba/tests/dba014.phpt @@ -0,0 +1,27 @@ +--TEST-- +DBA with array key with array containing too many elements +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +database handler: %s + +Catchable fatal error: dba_insert(): Key does not have exactly two elements: (key, name) in %sdba014.php on line %d diff --git a/ext/dba/tests/dba015.phpt b/ext/dba/tests/dba015.phpt new file mode 100644 index 0000000000..9f560c5b2f --- /dev/null +++ b/ext/dba/tests/dba015.phpt @@ -0,0 +1,76 @@ +--TEST-- +DBA with persistent connections +--SKIPIF-- + +--FILE-- + +===DONE=== +--CLEAN-- + +--XFAIL-- +Test 6 crashes in flatfile_findkey with dba pointer of NULL, bug http://bugs.php.net/bug.php?id=51278 +--EXPECTF-- +database handler: flatfile +Test 1 +This is a test insert 1 +Test 2 +resources are different +Test 3 - fetch both rows from second resource +This is a test insert 1 +This is a test insert 2 +Test 4 - fetch both rows from first resource +This is a test insert 1 +This is a test insert 2 +Test 5 - close 2nd resource +resource(%d) of type (dba persistent) +resource(%d) of type (Unknown) +Test 6 - query after closing 2nd resource +This is a test insert 1 +This is a test insert 2 +===DONE=== diff --git a/ext/dba/tests/dba_db4_003.phpt b/ext/dba/tests/dba_db4_003.phpt index 084bff8d87..7e8568c085 100644 --- a/ext/dba/tests/dba_db4_003.phpt +++ b/ext/dba/tests/dba_db4_003.phpt @@ -26,6 +26,10 @@ if (($db_file = dba_open($db_filename, "c", $handler)) !== FALSE) { echo "Error creating $db_filename\n"; } +// Check the file still exists +$s = file_get_contents($db_filename); +echo "$s\n"; + ?> --CLEAN--