From eddab740211e492d7ae9ef02b18c24f34dec9e50 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Thu, 28 Jul 2022 19:36:04 +0100 Subject: [PATCH] Improve DBA test suite (#8904) Generalises tests for all the different drivers. Run the general test for the various drivers. This allows support for parallel testing as the tests now do not rely on the same DB file. --- ext/dba/tests/CONFLICTS | 2 - ext/dba/tests/bug36436.phpt | 26 +- ext/dba/tests/bug48240.phpt | 28 -- ext/dba/tests/bug49125.phpt | 32 -- ext/dba/tests/bug62490.phpt | 43 --- ext/dba/tests/bug65708.phpt | 18 +- ext/dba/tests/bug72885.phpt | 28 -- ext/dba/tests/bug78808.phpt | 15 +- ext/dba/tests/dba001.phpt | 27 -- ext/dba/tests/dba002.phpt | 28 -- ext/dba/tests/dba003.phpt | 30 -- ext/dba/tests/dba004.phpt | 34 -- ext/dba/tests/dba005.phpt | 41 --- ext/dba/tests/dba006.phpt | 43 --- ext/dba/tests/dba007.phpt | 2 + ext/dba/tests/dba009.phpt | 2 + ext/dba/tests/dba010.phpt | 46 --- ext/dba/tests/dba013.phpt | 33 -- ext/dba/tests/dba014.phpt | 33 -- ext/dba/tests/dba015.phpt | 2 + ext/dba/tests/dba_array_keys.phpt | 37 +-- ext/dba/tests/dba_array_keys_errors.phpt | 55 ++++ ext/dba/tests/dba_array_keys_inifile.phpt | 42 +++ ...dba_array_keys_not_string_convertable.phpt | 41 --- .../tests/dba_array_keys_var_non_string.phpt | 25 +- ext/dba/tests/dba_cdb.phpt | 48 ++- ext/dba/tests/dba_cdb_001.phpt | 2 + ext/dba/tests/dba_cdb_creation_matrix.phpt | 195 ++++++++++++ ext/dba/tests/dba_cdb_make.phpt | 13 +- ext/dba/tests/dba_cdb_read.phpt | 6 +- ext/dba/tests/dba_db1.phpt | 83 +++-- ext/dba/tests/dba_db2.phpt | 83 +++-- ext/dba/tests/dba_db3.phpt | 83 +++-- ext/dba/tests/dba_db4_000.phpt | 80 +++-- ext/dba/tests/dba_db4_001.phpt | 34 -- ext/dba/tests/dba_db4_002.phpt | 34 -- ext/dba/tests/dba_db4_003.phpt | 46 --- ext/dba/tests/dba_db4_004.phpt | 42 --- ext/dba/tests/dba_db4_005.phpt | 34 -- ext/dba/tests/dba_db4_006.phpt | 34 -- ext/dba/tests/dba_db4_007.phpt | 41 --- ext/dba/tests/dba_db4_008.phpt | 42 --- ext/dba/tests/dba_db4_009.phpt | 44 +-- ext/dba/tests/dba_db4_011.phpt | 38 --- ext/dba/tests/dba_db4_012.phpt | 33 -- ext/dba/tests/dba_db4_013.phpt | 42 --- ext/dba/tests/dba_db4_014.phpt | 34 -- ext/dba/tests/dba_db4_015.phpt | 41 --- ext/dba/tests/dba_db4_016.phpt | 61 ---- ext/dba/tests/dba_db4_017.phpt | 39 --- ext/dba/tests/dba_db4_018.phpt | 2 + ext/dba/tests/dba_db4_creation_matrix.phpt | 171 ++++++++++ ext/dba/tests/dba_db4_handlers.phpt | 2 + ext/dba/tests/dba_db4_optimize.phpt | 2 + ext/dba/tests/dba_db4_sync.phpt | 2 + ext/dba/tests/dba_dbm.phpt | 56 ++-- ext/dba/tests/dba_fetch_legacy_signature.phpt | 25 +- ext/dba/tests/dba_flatfile.phpt | 81 +++-- .../tests/dba_flatfile_creation_matrix.phpt | 155 +++++++++ ext/dba/tests/dba_gdbm.phpt | 121 ++++++- ext/dba/tests/dba_gdbm_creation_matrix.phpt | 207 ++++++++++++ ext/dba/tests/dba_handler.inc | 98 ------ ext/dba/tests/dba_inifile.phpt | 88 ++++-- .../tests/dba_inifile_creation_matrix.phpt | 155 +++++++++ ext/dba/tests/dba_lmdb.phpt | 123 +++++++- ext/dba/tests/dba_lmdb_creation_matrix.phpt | 207 ++++++++++++ ext/dba/tests/dba_ndbm.phpt | 118 +++++-- ext/dba/tests/dba_qdbm.phpt | 119 ++++++- ext/dba/tests/dba_qdbm_creation_matrix.phpt | 207 ++++++++++++ ext/dba/tests/dba_split.phpt | 5 - ext/dba/tests/dba_sync.phpt | 2 + ext/dba/tests/dba_tcadb.phpt | 87 ++--- ext/dba/tests/dba_tcadb_creation_matrix.phpt | 179 +++++++++++ .../{dba012.phpt => default_handler_ini.phpt} | 14 +- ext/dba/tests/setup/setup_dba_tests.inc | 297 ++++++++++++++++++ .../{dba011.phpt => value_errors_open.phpt} | 4 +- ext/pgsql/tests/80_bug14383.phpt | 78 +++-- 77 files changed, 2887 insertions(+), 1663 deletions(-) delete mode 100644 ext/dba/tests/CONFLICTS delete mode 100644 ext/dba/tests/bug48240.phpt delete mode 100644 ext/dba/tests/bug49125.phpt delete mode 100644 ext/dba/tests/bug62490.phpt delete mode 100644 ext/dba/tests/bug72885.phpt delete mode 100644 ext/dba/tests/dba001.phpt delete mode 100644 ext/dba/tests/dba002.phpt delete mode 100644 ext/dba/tests/dba003.phpt delete mode 100644 ext/dba/tests/dba004.phpt delete mode 100644 ext/dba/tests/dba005.phpt delete mode 100644 ext/dba/tests/dba006.phpt delete mode 100644 ext/dba/tests/dba010.phpt delete mode 100644 ext/dba/tests/dba013.phpt delete mode 100644 ext/dba/tests/dba014.phpt create mode 100644 ext/dba/tests/dba_array_keys_errors.phpt create mode 100644 ext/dba/tests/dba_array_keys_inifile.phpt delete mode 100644 ext/dba/tests/dba_array_keys_not_string_convertable.phpt create mode 100644 ext/dba/tests/dba_cdb_creation_matrix.phpt delete mode 100644 ext/dba/tests/dba_db4_001.phpt delete mode 100644 ext/dba/tests/dba_db4_002.phpt delete mode 100644 ext/dba/tests/dba_db4_003.phpt delete mode 100644 ext/dba/tests/dba_db4_004.phpt delete mode 100644 ext/dba/tests/dba_db4_005.phpt delete mode 100644 ext/dba/tests/dba_db4_006.phpt delete mode 100644 ext/dba/tests/dba_db4_007.phpt delete mode 100644 ext/dba/tests/dba_db4_008.phpt delete mode 100644 ext/dba/tests/dba_db4_011.phpt delete mode 100644 ext/dba/tests/dba_db4_012.phpt delete mode 100644 ext/dba/tests/dba_db4_013.phpt delete mode 100644 ext/dba/tests/dba_db4_014.phpt delete mode 100644 ext/dba/tests/dba_db4_015.phpt delete mode 100644 ext/dba/tests/dba_db4_016.phpt delete mode 100644 ext/dba/tests/dba_db4_017.phpt create mode 100644 ext/dba/tests/dba_db4_creation_matrix.phpt create mode 100644 ext/dba/tests/dba_flatfile_creation_matrix.phpt create mode 100644 ext/dba/tests/dba_gdbm_creation_matrix.phpt delete mode 100644 ext/dba/tests/dba_handler.inc create mode 100644 ext/dba/tests/dba_inifile_creation_matrix.phpt create mode 100644 ext/dba/tests/dba_lmdb_creation_matrix.phpt create mode 100644 ext/dba/tests/dba_qdbm_creation_matrix.phpt create mode 100644 ext/dba/tests/dba_tcadb_creation_matrix.phpt rename ext/dba/tests/{dba012.phpt => default_handler_ini.phpt} (57%) create mode 100644 ext/dba/tests/setup/setup_dba_tests.inc rename ext/dba/tests/{dba011.phpt => value_errors_open.phpt} (95%) diff --git a/ext/dba/tests/CONFLICTS b/ext/dba/tests/CONFLICTS deleted file mode 100644 index 7c5f980770e..00000000000 --- a/ext/dba/tests/CONFLICTS +++ /dev/null @@ -1,2 +0,0 @@ -# Many of these tests work on the same database file -dba diff --git a/ext/dba/tests/bug36436.phpt b/ext/dba/tests/bug36436.phpt index d101c44272e..9e7603f5a39 100644 --- a/ext/dba/tests/bug36436.phpt +++ b/ext/dba/tests/bug36436.phpt @@ -4,21 +4,17 @@ Bug #36436 (DBA problem with Berkeley DB4) dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECTF-- resource(%d) of type (dba persistent) -string(3) "XYZ" -string(1) "X" -string(1) "Y" +string(16) "Content String 1" +string(13) "[key10]name10" +string(13) "[key30]name30" diff --git a/ext/dba/tests/bug48240.phpt b/ext/dba/tests/bug48240.phpt deleted file mode 100644 index 1c8a9b3c42f..00000000000 --- a/ext/dba/tests/bug48240.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #48240 (DBA Segmentation fault dba_nextkey) ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -bool(false) diff --git a/ext/dba/tests/bug49125.phpt b/ext/dba/tests/bug49125.phpt deleted file mode 100644 index 3228da5b5d0..00000000000 --- a/ext/dba/tests/bug49125.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Bug #49125 (Error in dba_exists C code) ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -bool(true) diff --git a/ext/dba/tests/bug62490.phpt b/ext/dba/tests/bug62490.phpt deleted file mode 100644 index 6646b27f97d..00000000000 --- a/ext/dba/tests/bug62490.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -Bug #62490 (dba_delete returns true on missing item (inifile)) ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -insert 0:bool(true) -insert 1:bool(true) -insert 2:bool(true) -exists:bool(true) -delete:bool(true) -exists:bool(false) -delete:bool(false) diff --git a/ext/dba/tests/bug65708.phpt b/ext/dba/tests/bug65708.phpt index b821d2b8ad8..1a5203e9cf8 100644 --- a/ext/dba/tests/bug65708.phpt +++ b/ext/dba/tests/bug65708.phpt @@ -4,16 +4,15 @@ Bug #65708 (dba functions cast $key param to string in-place, bypassing copy on dba --SKIPIF-- --FILE-- --CLEAN-- ---EXPECT-- +--EXPECTF-- +Using handler: "%s" integer integer integer diff --git a/ext/dba/tests/bug72885.phpt b/ext/dba/tests/bug72885.phpt deleted file mode 100644 index 9cfb244be86..00000000000 --- a/ext/dba/tests/bug72885.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #72885 flatfile: dba_fetch() fails to read replaced entry ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -bool(true) -string(3) "baz" diff --git a/ext/dba/tests/bug78808.phpt b/ext/dba/tests/bug78808.phpt index 329e0db5427..be25a85d3f5 100644 --- a/ext/dba/tests/bug78808.phpt +++ b/ext/dba/tests/bug78808.phpt @@ -4,15 +4,16 @@ Bug #78808 ([LMDB] MDB_MAP_FULL: Environment mapsize limit reached) dba --SKIPIF-- --FILE-- diff --git a/ext/dba/tests/dba001.phpt b/ext/dba/tests/dba001.phpt deleted file mode 100644 index f0adebe0c06..00000000000 --- a/ext/dba/tests/dba001.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -DBA File Creation Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -database file created diff --git a/ext/dba/tests/dba002.phpt b/ext/dba/tests/dba002.phpt deleted file mode 100644 index 771dea122f0..00000000000 --- a/ext/dba/tests/dba002.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -DBA Insert/Fetch Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -This is a test insert diff --git a/ext/dba/tests/dba003.phpt b/ext/dba/tests/dba003.phpt deleted file mode 100644 index 2f15eca2260..00000000000 --- a/ext/dba/tests/dba003.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -DBA Insert/Replace/Fetch Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -This is the replacement text diff --git a/ext/dba/tests/dba004.phpt b/ext/dba/tests/dba004.phpt deleted file mode 100644 index 3e7247ae65a..00000000000 --- a/ext/dba/tests/dba004.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -DBA Multiple Insert/Fetch Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -Another Content String Content String 2 diff --git a/ext/dba/tests/dba005.phpt b/ext/dba/tests/dba005.phpt deleted file mode 100644 index 9871901c2da..00000000000 --- a/ext/dba/tests/dba005.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -DBA FirstKey/NextKey Loop Test With 5 Items ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -5YYYYY diff --git a/ext/dba/tests/dba006.phpt b/ext/dba/tests/dba006.phpt deleted file mode 100644 index 2e70c984aec..00000000000 --- a/ext/dba/tests/dba006.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -DBA FirstKey/NextKey with 2 deletes ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -3NYNYY diff --git a/ext/dba/tests/dba007.phpt b/ext/dba/tests/dba007.phpt index 04a6b353640..507999dea16 100644 --- a/ext/dba/tests/dba007.phpt +++ b/ext/dba/tests/dba007.phpt @@ -8,6 +8,8 @@ dba if (!function_exists('dba_list')) die('skip dba_list() not available'); die("info $HND handler used"); ?> +--CONFLICTS-- +dba --FILE-- +--CONFLICTS-- +dba --FILE-- ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -6YYYYYY diff --git a/ext/dba/tests/dba013.phpt b/ext/dba/tests/dba013.phpt deleted file mode 100644 index 0d41341b040..00000000000 --- a/ext/dba/tests/dba013.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -DBA with array key with empty array ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s - -Fatal error: Uncaught Error: dba_insert(): Argument #1 ($key) must have exactly two elements: "key" and "name" in %s.php:%d -Stack trace: -#0 %sdba013.php(6): dba_insert(Array, '%s', Resource id #%d) -#1 {main} - thrown in %sdba013.php on line 6 diff --git a/ext/dba/tests/dba014.phpt b/ext/dba/tests/dba014.phpt deleted file mode 100644 index 1ed6d061118..00000000000 --- a/ext/dba/tests/dba014.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -DBA with array key with array containing too many elements ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s - -Fatal error: Uncaught Error: dba_insert(): Argument #1 ($key) must have exactly two elements: "key" and "name" in %s.php:%d -Stack trace: -#0 %sdba014.php(6): dba_insert(Array, '%s', Resource id #%d) -#1 {main} - thrown in %sdba014.php on line 6 diff --git a/ext/dba/tests/dba015.phpt b/ext/dba/tests/dba015.phpt index f20c4588633..5712edce59d 100644 --- a/ext/dba/tests/dba015.phpt +++ b/ext/dba/tests/dba015.phpt @@ -8,6 +8,8 @@ $handler = "flatfile"; require_once(__DIR__ .'/skipif.inc'); die("info $HND handler used"); ?> +--CONFLICTS-- +dba --FILE-- --FILE-- --CLEAN-- ---EXPECT-- +--EXPECTF-- +Using handler: "%s" bool(true) bool(true) bool(true) diff --git a/ext/dba/tests/dba_array_keys_errors.phpt b/ext/dba/tests/dba_array_keys_errors.phpt new file mode 100644 index 00000000000..d80915c7c31 --- /dev/null +++ b/ext/dba/tests/dba_array_keys_errors.phpt @@ -0,0 +1,55 @@ +--TEST-- +DBA with invalid array key +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- +getMessage(), \PHP_EOL; +} +try { + dba_insert(["a", "b", "c"], "Content String 2", $db); +} catch (\Error $e) { + echo $e::class, ': ', $e->getMessage(), \PHP_EOL; +} + +/* Use an object */ +$o = new stdClass(); +try { + var_dump(dba_insert([$o, 'obj'], 'Test', $db)); +} catch (\Error $e) { + echo $e::class, ': ', $e->getMessage(), \PHP_EOL; +} +try { + var_dump(dba_insert(['group', $o], 'Test', $db)); +} catch (\Error $e) { + echo $e::class, ': ', $e->getMessage(), \PHP_EOL; +} + +dba_close($db); + +?> +--CLEAN-- + +--EXPECTF-- +Using handler: "%s" +Error: dba_insert(): Argument #1 ($key) must have exactly two elements: "key" and "name" +Error: dba_insert(): Argument #1 ($key) must have exactly two elements: "key" and "name" +Error: Object of class stdClass could not be converted to string +Error: Object of class stdClass could not be converted to string diff --git a/ext/dba/tests/dba_array_keys_inifile.phpt b/ext/dba/tests/dba_array_keys_inifile.phpt new file mode 100644 index 00000000000..658b53b8c03 --- /dev/null +++ b/ext/dba/tests/dba_array_keys_inifile.phpt @@ -0,0 +1,42 @@ +--TEST-- +DBA check behaviour of array keys (inifile version) +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +bool(true) +bool(true) +bool(true) +bool(true) +string(12) "Normal group" +string(0) "" +string(11) "Empty group" +bool(false) diff --git a/ext/dba/tests/dba_array_keys_not_string_convertable.phpt b/ext/dba/tests/dba_array_keys_not_string_convertable.phpt deleted file mode 100644 index e89eed33d1d..00000000000 --- a/ext/dba/tests/dba_array_keys_not_string_convertable.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -DBA check behaviour of key as an array with elements not convertable to string ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- -getMessage(), \PHP_EOL; -} -try { - var_dump(dba_insert(['group', $o], 'Test', $db_file)); -} catch (\Error $e) { - echo $e::class, ': ', $e->getMessage(), \PHP_EOL; -} - -dba_close($db_file); - -?> ---CLEAN-- - ---EXPECT-- -Error: Object of class stdClass could not be converted to string -Error: Object of class stdClass could not be converted to string diff --git a/ext/dba/tests/dba_array_keys_var_non_string.phpt b/ext/dba/tests/dba_array_keys_var_non_string.phpt index f6a92cc74f6..1ba64ec40b6 100644 --- a/ext/dba/tests/dba_array_keys_var_non_string.phpt +++ b/ext/dba/tests/dba_array_keys_var_non_string.phpt @@ -4,34 +4,35 @@ DBA check behaviour of key as an array with non string elements dba --SKIPIF-- --FILE-- --CLEAN-- ---EXPECT-- +--EXPECTF-- +Using handler: "%s" array(2) { [0]=> int(5) diff --git a/ext/dba/tests/dba_cdb.phpt b/ext/dba/tests/dba_cdb.phpt index 0cdbea3f916..6b0c7c6649f 100644 --- a/ext/dba/tests/dba_cdb.phpt +++ b/ext/dba/tests/dba_cdb.phpt @@ -4,25 +4,34 @@ DBA CDB handler test dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- -database handler: cdb -5YYYYY -Content String 2 -array(5) { +Key 1 exists? Y +Key 2 exists? Y +Key 3 exists? Y +Key 4 exists? Y +Key 5 exists? Y +array(8) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key1"]=> string(16) "Content String 1" ["key2"]=> @@ -33,11 +42,20 @@ array(5) { string(22) "Another Content String" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } --NO-LOCK-- -5YYYYY -Content String 2 -array(5) { +Key 1 exists? Y +Key 2 exists? Y +Key 3 exists? Y +Key 4 exists? Y +Key 5 exists? Y +array(8) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key1"]=> string(16) "Content String 1" ["key2"]=> @@ -48,4 +66,6 @@ array(5) { string(22) "Another Content String" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } diff --git a/ext/dba/tests/dba_cdb_001.phpt b/ext/dba/tests/dba_cdb_001.phpt index 7e29c3975ed..5aa5d615c09 100644 --- a/ext/dba/tests/dba_cdb_001.phpt +++ b/ext/dba/tests/dba_cdb_001.phpt @@ -8,6 +8,8 @@ $handler = 'cdb'; require_once(__DIR__ .'/skipif.inc'); die('info CDB does not support replace or delete'); ?> +--CONFLICTS-- +dba --FILE-- +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "nl": +Cannot fetch insertion +Mode parameter is "nd": +Cannot fetch insertion +Mode parameter is "n-": +Cannot fetch insertion +Mode parameter is "n": +Cannot fetch insertion +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "nl": +Cannot fetch insertion +Mode parameter is "nd": +Cannot fetch insertion +Mode parameter is "n-": +Cannot fetch insertion +Mode parameter is "n": +Cannot fetch insertion +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "nl": +Cannot fetch insertion +Mode parameter is "nd": +Cannot fetch insertion +Mode parameter is "n-": +Cannot fetch insertion +Mode parameter is "n": +Cannot fetch insertion diff --git a/ext/dba/tests/dba_cdb_make.phpt b/ext/dba/tests/dba_cdb_make.phpt index 8063d079455..447daf309a5 100644 --- a/ext/dba/tests/dba_cdb_make.phpt +++ b/ext/dba/tests/dba_cdb_make.phpt @@ -4,14 +4,15 @@ DBA CDB_MAKE handler test dba --SKIPIF-- +--CONFLICTS-- +test.cdb --FILE-- --CLEAN-- --EXPECT-- database handler: cdb_make diff --git a/ext/dba/tests/dba_cdb_read.phpt b/ext/dba/tests/dba_cdb_read.phpt index 40a7dc91872..9d67e170721 100644 --- a/ext/dba/tests/dba_cdb_read.phpt +++ b/ext/dba/tests/dba_cdb_read.phpt @@ -4,9 +4,11 @@ DBA CDB handler test (read only) dba --SKIPIF-- +--CONFLICTS-- +test.cdb --FILE-- --FILE-- +--CLEAN-- + --EXPECT-- -database handler: db1 -3NYNYY -Content String 2 +=== RUNNING WITH FILE LOCK === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +[key10]name10: Content String 10 +[key30]name30: Content String 30 +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { - ["key number 6"]=> - string(13) "The 6th value" - ["key2"]=> - string(27) "Content 2 replaced 2nd time" - ["key5"]=> - string(23) "The last content string" -} ---NO-LOCK-- -3NYNYY -Content String 2 -Content 2 replaced -Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock) diff --git a/ext/dba/tests/dba_db2.phpt b/ext/dba/tests/dba_db2.phpt index 792c745aa2e..690ecbbd9b6 100644 --- a/ext/dba/tests/dba_db2.phpt +++ b/ext/dba/tests/dba_db2.phpt @@ -4,47 +4,70 @@ DBA DB2 handler test dba --SKIPIF-- --FILE-- +--CLEAN-- + --EXPECT-- -database handler: db2 -3NYNYY -Content String 2 +=== RUNNING WITH FILE LOCK === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +[key10]name10: Content String 10 +[key30]name30: Content String 30 +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { - ["key number 6"]=> - string(13) "The 6th value" - ["key2"]=> - string(27) "Content 2 replaced 2nd time" - ["key5"]=> - string(23) "The last content string" -} ---NO-LOCK-- -3NYNYY -Content String 2 -Content 2 replaced -Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock) diff --git a/ext/dba/tests/dba_db3.phpt b/ext/dba/tests/dba_db3.phpt index 4f3e54723e6..bb262bcbc67 100644 --- a/ext/dba/tests/dba_db3.phpt +++ b/ext/dba/tests/dba_db3.phpt @@ -4,47 +4,70 @@ DBA DB3 handler test dba --SKIPIF-- --FILE-- +--CLEAN-- + --EXPECT-- -database handler: db3 -3NYNYY -Content String 2 +=== RUNNING WITH FILE LOCK === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +[key10]name10: Content String 10 +[key30]name30: Content String 30 +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { - ["key number 6"]=> - string(13) "The 6th value" - ["key2"]=> - string(27) "Content 2 replaced 2nd time" - ["key5"]=> - string(23) "The last content string" -} ---NO-LOCK-- -3NYNYY -Content String 2 -Content 2 replaced -Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock) diff --git a/ext/dba/tests/dba_db4_000.phpt b/ext/dba/tests/dba_db4_000.phpt index 872a0fca718..5b97d68c884 100644 --- a/ext/dba/tests/dba_db4_000.phpt +++ b/ext/dba/tests/dba_db4_000.phpt @@ -4,51 +4,71 @@ DBA DB4 handler test dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- -database handler: db4 -3NYNYY -Content String 2 +=== RUNNING WITH FILE LOCK === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +[key10]name10: Content String 10 +[key30]name30: Content String 30 +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { - ["key number 6"]=> - string(13) "The 6th value" - ["key2"]=> - string(27) "Content 2 replaced 2nd time" - ["key5"]=> - string(23) "The last content string" -} ---NO-LOCK-- -3NYNYY -Content String 2 -Content 2 replaced -Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock) diff --git a/ext/dba/tests/dba_db4_001.phpt b/ext/dba/tests/dba_db4_001.phpt deleted file mode 100644 index f3cc54afb96..00000000000 --- a/ext/dba/tests/dba_db4_001.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -DBA DB4 New File Creation open("c") & Insert Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -This is a test insert diff --git a/ext/dba/tests/dba_db4_002.phpt b/ext/dba/tests/dba_db4_002.phpt deleted file mode 100644 index feeb85f73b7..00000000000 --- a/ext/dba/tests/dba_db4_002.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -DBA DB4 New File Creation open("n") & Insert Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -This is a test insert diff --git a/ext/dba/tests/dba_db4_003.phpt b/ext/dba/tests/dba_db4_003.phpt deleted file mode 100644 index 397b3367521..00000000000 --- a/ext/dba/tests/dba_db4_003.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -DBA DB4 File Creation open("c") with existing file ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: db4 -int(14) - -Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %sdba_db4_003.php on line %d -Error creating %stest0.dbm -Dummy contents diff --git a/ext/dba/tests/dba_db4_004.phpt b/ext/dba/tests/dba_db4_004.phpt deleted file mode 100644 index 70c9e7d2ad3..00000000000 --- a/ext/dba/tests/dba_db4_004.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -DBA DB4 Truncate Existing File open("n") ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -int(14) -database file created -This is a test insert diff --git a/ext/dba/tests/dba_db4_005.phpt b/ext/dba/tests/dba_db4_005.phpt deleted file mode 100644 index ae6653d9321..00000000000 --- a/ext/dba/tests/dba_db4_005.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -DBA DB4 New File Creation popen("c") & Insert Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -This is a test insert diff --git a/ext/dba/tests/dba_db4_006.phpt b/ext/dba/tests/dba_db4_006.phpt deleted file mode 100644 index 4da1ac4acec..00000000000 --- a/ext/dba/tests/dba_db4_006.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -DBA DB4 New File Creation popen("n") & Insert Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -This is a test insert diff --git a/ext/dba/tests/dba_db4_007.phpt b/ext/dba/tests/dba_db4_007.phpt deleted file mode 100644 index b62a5df2c2e..00000000000 --- a/ext/dba/tests/dba_db4_007.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -DBA DB4 File Creation popen("c") with existing invalid file ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: db4 -int(14) - -Warning: dba_popen(): Driver initialization failed for handler: db4: Invalid argument in %sdba_db4_007.php on line %d -Error creating %stest0.dbm diff --git a/ext/dba/tests/dba_db4_008.phpt b/ext/dba/tests/dba_db4_008.phpt deleted file mode 100644 index e10eb822a40..00000000000 --- a/ext/dba/tests/dba_db4_008.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -DBA DB4 Truncate Existing File popen("n") ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -int(14) -database file created -This is a test insert diff --git a/ext/dba/tests/dba_db4_009.phpt b/ext/dba/tests/dba_db4_009.phpt index e4dd2954071..bc47c350753 100644 --- a/ext/dba/tests/dba_db4_009.phpt +++ b/ext/dba/tests/dba_db4_009.phpt @@ -4,50 +4,32 @@ DBA DB4 Multiple File Creation Test dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECTF-- database handler: db4 -database file created -database file created -database file created -array(3) { - [%d]=> - string(%d) "%stest0.dbm" +array(2) { [%d]=> string(%d) "%stest1.dbm" [%d]=> diff --git a/ext/dba/tests/dba_db4_011.phpt b/ext/dba/tests/dba_db4_011.phpt deleted file mode 100644 index 78252e97c6f..00000000000 --- a/ext/dba/tests/dba_db4_011.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -DBA DB4 with repeated key ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -bool(true) -bool(true) -bool(false) -Content String 1 -Content String 2 diff --git a/ext/dba/tests/dba_db4_012.phpt b/ext/dba/tests/dba_db4_012.phpt deleted file mode 100644 index f5c29d993f0..00000000000 --- a/ext/dba/tests/dba_db4_012.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -DBA DB4 New File Creation open("rl") ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: db4 - -Warning: dba_open(): Driver initialization failed for handler: db4: No such file or directory in %sdba_db4_012.php on line %d -Error creating %stest0.dbm diff --git a/ext/dba/tests/dba_db4_013.phpt b/ext/dba/tests/dba_db4_013.phpt deleted file mode 100644 index f0018339271..00000000000 --- a/ext/dba/tests/dba_db4_013.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -DBA DB4 File open("rl") & Insert Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: db4 -database file created -database file opened - -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %sdba_db4_013.php on line %d diff --git a/ext/dba/tests/dba_db4_014.phpt b/ext/dba/tests/dba_db4_014.phpt deleted file mode 100644 index 8ccceb5dcbe..00000000000 --- a/ext/dba/tests/dba_db4_014.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -DBA DB4 File open("wl") & Insert Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: db4 - -Warning: dba_open(): Driver initialization failed for handler: db4: No such file or directory in %sdba_db4_014.php on line %d -Error creating %stest0.dbm diff --git a/ext/dba/tests/dba_db4_015.phpt b/ext/dba/tests/dba_db4_015.phpt deleted file mode 100644 index e3a3332d83d..00000000000 --- a/ext/dba/tests/dba_db4_015.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -DBA DB4 File open("wl") & Insert Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -database file opened -This is a test insert diff --git a/ext/dba/tests/dba_db4_016.phpt b/ext/dba/tests/dba_db4_016.phpt deleted file mode 100644 index f0550530d46..00000000000 --- a/ext/dba/tests/dba_db4_016.phpt +++ /dev/null @@ -1,61 +0,0 @@ ---TEST-- -DBA DB4 File Creation popen("c") with existing valid file ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -bool(true) -This is a test insert -database file created -bool(false) -bool(true) -This is a test insert -second open test row 2 diff --git a/ext/dba/tests/dba_db4_017.phpt b/ext/dba/tests/dba_db4_017.phpt deleted file mode 100644 index 74e6cb73c55..00000000000 --- a/ext/dba/tests/dba_db4_017.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -DBA DB4 file creation dba_open("cd") ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -bool(true) -This is a test insert diff --git a/ext/dba/tests/dba_db4_018.phpt b/ext/dba/tests/dba_db4_018.phpt index 8c792e466cf..dd360a2ec6b 100644 --- a/ext/dba/tests/dba_db4_018.phpt +++ b/ext/dba/tests/dba_db4_018.phpt @@ -2,6 +2,8 @@ DBA DB4 with persistent connections --EXTENSIONS-- dba +--CONFLICTS-- +dba --SKIPIF-- +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Warning: dba_open(): Driver initialization failed for handler: db4: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(db4_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Driver initialization failed for handler: db4: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(db4_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: db4: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(db4_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: db4: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(db4_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "wl": +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": +This is a test insert +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert diff --git a/ext/dba/tests/dba_db4_handlers.phpt b/ext/dba/tests/dba_db4_handlers.phpt index b0056cf6e30..0358ed63d27 100644 --- a/ext/dba/tests/dba_db4_handlers.phpt +++ b/ext/dba/tests/dba_db4_handlers.phpt @@ -2,6 +2,8 @@ DBA DB4 Handler Test --EXTENSIONS-- dba +--CONFLICTS-- +dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- -database handler: dbm -3NYNYY -Content String 2 +key4: Another Content String +key2: Content String 2 +key5: The last content string +Total keys: 3 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { - ["key number 6"]=> - string(13) "The 6th value" - ["key2"]=> - string(27) "Content 2 replaced 2nd time" - ["key5"]=> - string(23) "The last content string" -} ---NO-LOCK-- -3NYNYY -Content String 2 -Content 2 replaced -Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Delete "key4" +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value array(3) { ["key number 6"]=> string(13) "The 6th value" diff --git a/ext/dba/tests/dba_fetch_legacy_signature.phpt b/ext/dba/tests/dba_fetch_legacy_signature.phpt index 847c191612c..7bb71372f97 100644 --- a/ext/dba/tests/dba_fetch_legacy_signature.phpt +++ b/ext/dba/tests/dba_fetch_legacy_signature.phpt @@ -4,27 +4,28 @@ dba_fetch() legacy signature dba --SKIPIF-- --FILE-- --CLEAN-- ---EXPECT-- +--EXPECTF-- +Using handler: "%s" This is a test insert This is a test insert diff --git a/ext/dba/tests/dba_flatfile.phpt b/ext/dba/tests/dba_flatfile.phpt index 955df6d1bf6..9d989e9069b 100644 --- a/ext/dba/tests/dba_flatfile.phpt +++ b/ext/dba/tests/dba_flatfile.phpt @@ -4,51 +4,70 @@ DBA FlatFile handler test dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- -database handler: flatfile -3NYNYY -Content String 2 +=== RUNNING WITH FILE LOCK === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +[key10]name10: Content String 10 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { - ["key number 6"]=> - string(13) "The 6th value" - ["key2"]=> - string(27) "Content 2 replaced 2nd time" - ["key5"]=> - string(23) "The last content string" -} ---NO-LOCK-- -3NYNYY -Content String 2 -Content 2 replaced -Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock) diff --git a/ext/dba/tests/dba_flatfile_creation_matrix.phpt b/ext/dba/tests/dba_flatfile_creation_matrix.phpt new file mode 100644 index 00000000000..6009c077894 --- /dev/null +++ b/ext/dba/tests/dba_flatfile_creation_matrix.phpt @@ -0,0 +1,155 @@ +--TEST-- +DBA flatfile opening matrix of combination +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "wl": +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": +This is a test insert +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "wl": +Cannot fetch insertion +Mode parameter is "wd": +Cannot fetch insertion +Mode parameter is "w-": +Cannot fetch insertion +Mode parameter is "w": +Cannot fetch insertion +Mode parameter is "cl": +Cannot fetch insertion +Mode parameter is "cd": +Cannot fetch insertion +Mode parameter is "c-": +Cannot fetch insertion +Mode parameter is "c": +Cannot fetch insertion +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert diff --git a/ext/dba/tests/dba_gdbm.phpt b/ext/dba/tests/dba_gdbm.phpt index 4752b4bbc43..480e6063b52 100644 --- a/ext/dba/tests/dba_gdbm.phpt +++ b/ext/dba/tests/dba_gdbm.phpt @@ -4,33 +4,122 @@ DBA GDBM handler test dba --SKIPIF-- --FILE-- +--CLEAN-- + --EXPECTF-- -database handler: gdbm -3NYNYY -Content String 2 +=== RUNNING WITH FILE LOCK === + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key4: Another Content String +key2: Content String 2 +key5: The last content string +[key10]name10: Content String 10 +name9: Content String 9 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced -Read during write:%sallowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Read during write: not allowed +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value + +Notice: dba_open(): Handler gdbm does locking internally in %s on line 1%d +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key4: Another Content String +key2: Content String 2 +key5: The last content string +[key10]name10: Content String 10 +name9: Content String 9 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) +Content 2 replaced +Read during write: not allowed +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" +} +=== RUNNING WITH NO LOCK === + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Failed to create DB diff --git a/ext/dba/tests/dba_gdbm_creation_matrix.phpt b/ext/dba/tests/dba_gdbm_creation_matrix.phpt new file mode 100644 index 00000000000..b254819a21a --- /dev/null +++ b/ext/dba/tests/dba_gdbm_creation_matrix.phpt @@ -0,0 +1,207 @@ +--TEST-- +DBA GDBM opening matrix of combination +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: gdbm: File open error in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: File open error in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: File open error in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: gdbm: File open error in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: File open error in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: File open error in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "wl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d +Opening DB failed +Mode parameter is "nl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed +Mode parameter is "n": +This is a test insert diff --git a/ext/dba/tests/dba_handler.inc b/ext/dba/tests/dba_handler.inc deleted file mode 100644 index 9b9d030c39b..00000000000 --- a/ext/dba/tests/dba_handler.inc +++ /dev/null @@ -1,98 +0,0 @@ - diff --git a/ext/dba/tests/dba_inifile.phpt b/ext/dba/tests/dba_inifile.phpt index c85732a02ea..06be22c085f 100644 --- a/ext/dba/tests/dba_inifile.phpt +++ b/ext/dba/tests/dba_inifile.phpt @@ -4,51 +4,77 @@ DBA INIFILE handler test dba --SKIPIF-- --FILE-- --CLEAN-- +--WHITESPACE_SENSITIVE-- --EXPECT-- -database handler: inifile -3NYNYY -Content String 2 +=== RUNNING WITH FILE LOCK === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +[key10]: +[key10]name10: Content String 10 +[key30]: +[key30]name30: Content String 30 +Total keys: 8 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -"key number 6" written 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { - ["key number 6"]=> - string(13) "The 6th value" - ["key2"]=> - string(27) "Content 2 replaced 2nd time" - ["key5"]=> - string(23) "The last content string" -} ---NO-LOCK-- -3NYNYY -Content String 2 -Content 2 replaced -Read during write: not allowed -"key number 6" written -"key number 6" written 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Unexpected: Wrote data to already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(8) { + ["[key10]"]=> + string(0) "" + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]"]=> + string(0) "" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock) diff --git a/ext/dba/tests/dba_inifile_creation_matrix.phpt b/ext/dba/tests/dba_inifile_creation_matrix.phpt new file mode 100644 index 00000000000..aff1fdfb4f1 --- /dev/null +++ b/ext/dba/tests/dba_inifile_creation_matrix.phpt @@ -0,0 +1,155 @@ +--TEST-- +DBA INIFILE opening matrix of combination +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "wl": +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": +This is a test insert +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "wl": +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": +This is a test insert +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert diff --git a/ext/dba/tests/dba_lmdb.phpt b/ext/dba/tests/dba_lmdb.phpt index d119d2d59b0..7f8047f5808 100644 --- a/ext/dba/tests/dba_lmdb.phpt +++ b/ext/dba/tests/dba_lmdb.phpt @@ -4,35 +4,126 @@ DBA LMDB handler test dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECTF-- -database handler: lmdb -3NYNYY -Content String 2 +=== RUNNING WITH FILE LOCK === + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again + +Warning: dba_delete(): MDB_NOTFOUND: No matching key/data pair found in %s on line %d +bool(false) +[key10]name10: Content String 10 +[key30]name30: Content String 30 +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced -Read during write:%sallowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Read during write: not allowed +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again + +Warning: dba_delete(): MDB_NOTFOUND: No matching key/data pair found in %s on line %d +bool(false) +[key10]name10: Content String 10 +[key30]name30: Content String 30 +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) +Content 2 replaced +Read during write: not allowed +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" +} +=== RUNNING WITH NO LOCK === + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Failed to create DB diff --git a/ext/dba/tests/dba_lmdb_creation_matrix.phpt b/ext/dba/tests/dba_lmdb_creation_matrix.phpt new file mode 100644 index 00000000000..ffe861934a2 --- /dev/null +++ b/ext/dba/tests/dba_lmdb_creation_matrix.phpt @@ -0,0 +1,207 @@ +--TEST-- +DBA LMDB opening matrix of combination +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: lmdb: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "wl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "nl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "nd": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "n": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed diff --git a/ext/dba/tests/dba_ndbm.phpt b/ext/dba/tests/dba_ndbm.phpt index ec3df0dcd26..5c50370947e 100644 --- a/ext/dba/tests/dba_ndbm.phpt +++ b/ext/dba/tests/dba_ndbm.phpt @@ -4,47 +4,123 @@ DBA NDBM handler test dba --SKIPIF-- --FILE-- +--CLEAN-- + --EXPECT-- -database handler: ndbm -3NYNYY -Content String 2 +=== RUNNING WITH FILE LOCK === + +Notice: dba_open(): Handler ndbm does locking internally in /home/girgias/Dev/php-src/ext/dba/tests/setup/setup_dba_tests.inc on line 40 + +Notice: dba_open(): Handler ndbm does locking internally in /home/girgias/Dev/php-src/ext/dba/tests/setup/setup_dba_tests.inc on line 40 + +Notice: dba_open(): Handler ndbm does locking internally in /home/girgias/Dev/php-src/ext/dba/tests/setup/setup_dba_tests.inc on line 82 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key4: Another Content String +key2: Content String 2 +key5: The last content string +[key10]name10: Content String 10 +name9: Content String 9 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value + +Notice: dba_open(): Handler ndbm does locking internally in /home/girgias/Dev/php-src/ext/dba/tests/setup/setup_dba_tests.inc on line 149 +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } ---NO-LOCK-- -3NYNYY -Content String 2 +=== RUNNING WITH DB LOCK (default) === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key4: Another Content String +key2: Content String 2 +key5: The last content string +[key10]name10: Content String 10 +name9: Content String 9 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH NO LOCK === + +Warning: dba_open(): Locking cannot be disabled for handler ndbm in /home/girgias/Dev/php-src/ext/dba/tests/setup/setup_dba_tests.inc on line 40 +Failed to create DB diff --git a/ext/dba/tests/dba_qdbm.phpt b/ext/dba/tests/dba_qdbm.phpt index 300ca514bda..e4321e7dc37 100644 --- a/ext/dba/tests/dba_qdbm.phpt +++ b/ext/dba/tests/dba_qdbm.phpt @@ -4,35 +4,122 @@ DBA QDBM handler test dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECTF-- -database handler: qdbm -3NYNYY -Content String 2 +=== RUNNING WITH FILE LOCK === + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +[key10]name10: Content String 10 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced -Read during write:%sallowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Read during write: not allowed +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value + +Notice: dba_open(): Handler qdbm does locking internally in %s on line 1%d +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +[key10]name10: Content String 10 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) +Content 2 replaced +Read during write: not allowed +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" +} +=== RUNNING WITH NO LOCK === + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Failed to create DB diff --git a/ext/dba/tests/dba_qdbm_creation_matrix.phpt b/ext/dba/tests/dba_qdbm_creation_matrix.phpt new file mode 100644 index 00000000000..299dc70ec54 --- /dev/null +++ b/ext/dba/tests/dba_qdbm_creation_matrix.phpt @@ -0,0 +1,207 @@ +--TEST-- +DBA QDBM opening matrix of combination +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: qdbm: open error in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: open error in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: open error in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: qdbm: open error in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: open error in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: open error in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "wl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "nl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "n": +This is a test insert diff --git a/ext/dba/tests/dba_split.phpt b/ext/dba/tests/dba_split.phpt index 1f9f3125105..70cbe14caee 100644 --- a/ext/dba/tests/dba_split.phpt +++ b/ext/dba/tests/dba_split.phpt @@ -2,11 +2,6 @@ DBA Split Test --EXTENSIONS-- dba ---SKIPIF-- - --FILE-- --FILE-- --CLEAN-- --EXPECT-- -database handler: tcadb -3NYNYY -Content String 2 +=== RUNNING WITH FILE LOCK === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +[key10]name10: Content String 10 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { - ["key number 6"]=> - string(13) "The 6th value" - ["key2"]=> - string(27) "Content 2 replaced 2nd time" - ["key5"]=> - string(23) "The last content string" -} ---NO-LOCK-- -3NYNYY -Content String 2 -Content 2 replaced -Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN diff --git a/ext/dba/tests/dba_tcadb_creation_matrix.phpt b/ext/dba/tests/dba_tcadb_creation_matrix.phpt new file mode 100644 index 00000000000..e86efce75ca --- /dev/null +++ b/ext/dba/tests/dba_tcadb_creation_matrix.phpt @@ -0,0 +1,179 @@ +--TEST-- +DBA tcadb opening matrix of combination +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(tcadb_not_existing.tch): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(tcadb_not_existing.tch): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(tcadb_not_existing.tch): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(tcadb_not_existing.tch): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d +Insertion failed +Mode parameter is "wl": +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": +This is a test insert +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "nl": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "nd": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "n-": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "n": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed diff --git a/ext/dba/tests/dba012.phpt b/ext/dba/tests/default_handler_ini.phpt similarity index 57% rename from ext/dba/tests/dba012.phpt rename to ext/dba/tests/default_handler_ini.phpt index 9ef0f329ccd..ba115f76e20 100644 --- a/ext/dba/tests/dba012.phpt +++ b/ext/dba/tests/default_handler_ini.phpt @@ -4,15 +4,15 @@ DBA dba.default_handler tests dba --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 +Warning: ini_set(): No such handler: does_not_exist in %s on line %d resource(%d) of type (dba) Test 2 -Warning: dba_open(): No default handler selected in %sdba012.php on line %d +Warning: dba_open(): No default handler selected in %s on line %d bool(false) diff --git a/ext/dba/tests/setup/setup_dba_tests.inc b/ext/dba/tests/setup/setup_dba_tests.inc new file mode 100644 index 00000000000..3e79ed3d54c --- /dev/null +++ b/ext/dba/tests/setup/setup_dba_tests.inc @@ -0,0 +1,297 @@ +value; + // Open file in creation/truncation mode + $func = $persistent ? 'dba_popen' : 'dba_open'; + + $db_file = $func($name, 'n'.$lock_flag, $handler); + + if ($db_file === false) { + die("Failed to create DB"); + } + + // Insert some data + dba_insert("key1", "Content String 1", $db_file); + dba_insert("key2", "Content String 2", $db_file); + dba_insert("key3", "Third Content String", $db_file); + dba_insert("key4", "Another Content String", $db_file); + dba_insert("key5", "The last content string", $db_file); + + // Insert date with array keys + dba_insert(["", "name9"], "Content String 9", $db_file); + dba_insert(["key10", "name10"] , "Content String 10", $db_file); + dba_insert("[key30]name30", "Content String 30", $db_file); + + return $db_file; +} + +function set_up_db(string $handler, string $name, LockFlag $lock = LockFlag::FileLock): void { + $db_file = set_up_db_ex($handler, $name, $lock); + // Close creation/truncation handler + dba_close($db_file); +} + +function run_common_read_only_test($dbHandle): void { + $key = dba_firstkey($dbHandle); + $result = []; + while ($key) { + $result[$key] = dba_fetch($key, $dbHandle); + $key = dba_nextkey($dbHandle); + } + ksort($result); + var_dump($result); +} + +function run_standard_tests_ex(string $handler, string $name, LockFlag $lock, bool $persistent = false): void +{ + $lock_flag = $lock->value; + set_up_db($handler, $name, $lock); + $db_writer = dba_open($name, 'w'.$lock_flag, $handler); + if ($db_writer === false) { + die("Failed to open DB for write"); + } + + echo 'Remove key 1 and 3', \PHP_EOL; + var_dump(dba_delete("key3", $db_writer)); + var_dump(dba_delete("key1", $db_writer)); + + echo 'Try to remove key 1 again', \PHP_EOL; + var_dump(dba_delete("key1", $db_writer)); + + // Fetch data + $key = dba_firstkey($db_writer); + $total_keys = 0; + while ($key) { + echo $key, ': ', dba_fetch($key, $db_writer), \PHP_EOL; + $key = dba_nextkey($db_writer); + $total_keys++; + } + echo 'Total keys: ', $total_keys, \PHP_EOL; + for ($i = 1; $i < 6; $i++) { + echo "Key $i exists? ", dba_exists("key$i", $db_writer) ? 'Y' : 'N', \PHP_EOL; + } + + echo 'Replace second key data', \PHP_EOL; + var_dump(dba_replace('key2', 'Content 2 replaced', $db_writer)); + echo dba_fetch('key2', $db_writer), \PHP_EOL; + + // Check that read is possible when a lock is used + $test_flag = 't'; + if ($lock === LockFlag::NoLock) { + // No point testing when we don't use locks + $test_flag = ''; + } + $db_reader = @dba_open($name, 'r'.$lock_flag.$test_flag, $handler); + if ($db_reader === false) { + echo 'Read during write: not allowed', \PHP_EOL; + } else { + echo 'Read during write: allowed', \PHP_EOL; + dba_close($db_reader); + } + + if (dba_insert('key number 6', 'The 6th value', $db_writer)) { + echo 'Expected: Added a new data entry', \PHP_EOL; + } else { + echo 'Unexpected: Failed to add a new data entry', \PHP_EOL; + } + + if (dba_insert('key number 6', 'The 6th value inserted again would be an error', $db_writer)) { + echo 'Unexpected: Wrote data to already used key', \PHP_EOL; + } else { + echo 'Expected: Failed to insert data for already used key', \PHP_EOL; + } + + echo 'Replace second key data', \PHP_EOL; + var_dump(dba_replace('key2', 'Content 2 replaced 2nd time', $db_writer)); + echo 'Delete "key4"', \PHP_EOL; + var_dump(dba_delete('key4', $db_writer)); + echo 'Fetch "key2": ', dba_fetch('key2', $db_writer), \PHP_EOL; + echo 'Fetch "key number 6": ', dba_fetch('key number 6', $db_writer), \PHP_EOL; + dba_close($db_writer); // when the writer is open at least db3 would fail because of buffered io. + + $db_reader = dba_open($name, 'r'.$lock_flag, $handler); + run_common_read_only_test($db_reader); + dba_close($db_reader); + + /* TODO popen test? Old code copied from the previous general test + if (($db_file = dba_popen($db_filename, 'r'.($lock_flag==''?'':'-'), $handler))!==FALSE) { + if ($handler == 'dbm' || $handler == "tcadb") { + dba_close($db_file); + } + } + */ +} + +const MODES = ['r', 'w', 'c', 'n']; +const LOCKS = ['l', 'd', '-', '' /* No lock flag is like 'd' */]; +function run_creation_tests_ex(string $handler, string $file_suffix, string $pre_req): void +{ + $db_name = $handler . $file_suffix; + foreach (MODES as $mode) { + foreach (LOCKS as $lock) { + eval($pre_req); + $arg = $mode.$lock; + echo 'Mode parameter is "', $arg, '":', \PHP_EOL; + $db = dba_open($db_name, $arg, $handler); + if ($db !== false) { + assert(file_exists($db_name)); + $status = dba_insert("key1", "This is a test insert", $db); + if ($status) { + $fetch = dba_fetch("key1", $db); + if ($fetch === false) { + echo 'Cannot fetch insertion', \PHP_EOL; + } else { + echo $fetch, \PHP_EOL; + } + } else { + echo 'Insertion failed', \PHP_EOL; + } + dba_close($db); + } else { + echo 'Opening DB failed', \PHP_EOL; + } + cleanup_standard_db($db_name); + } + } +} + +function run_creation_tests(string $handler): void +{ + $extension = $handler === 'tcadb' ? 'tch' : 'db'; + /* Trying to open a non-existing file */ + echo '=== OPENING NON-EXISTING FILE ===', \PHP_EOL; + run_creation_tests_ex($handler, '_not_existing.'.$extension, ''); + + /* Trying to open an existing db file */ + echo '=== OPENING EXISTING DB FILE ===', \PHP_EOL; + run_creation_tests_ex($handler, '_existing.'.$extension, 'dba_open($db_name, "n", $handler);'); + + /* Trying to open an existing random file */ + echo '=== OPENING EXISTING RANDOM FILE ===', \PHP_EOL; + run_creation_tests_ex($handler, '_random.txt', 'file_put_contents($db_name, "Dummy contents");'); +} + +function clean_creation_tests(string $handler): void { + $db_name = $handler . '_not_existing.db'; + cleanup_standard_db($db_name); + $db_name = $handler . '_existing.db'; + cleanup_standard_db($db_name); + $db_name = $handler . '_random.txt'; + cleanup_standard_db($db_name); +} + +function run_standard_tests(string $handler, string $name): void { + echo '=== RUNNING WITH FILE LOCK ===', \PHP_EOL; + ob_start(); + set_up_db($handler, $name, LockFlag::FileLock); + run_standard_tests_ex($handler, $name, LockFlag::FileLock); + cleanup_standard_db($name); + $run1_output = ob_get_flush(); + echo '=== RUNNING WITH DB LOCK (default) ===', \PHP_EOL; + ob_start(); + set_up_db($handler, $name, LockFlag::DbLock); + run_standard_tests_ex($handler, $name, LockFlag::DbLock); + cleanup_standard_db($name); + $run2_output = ob_get_clean(); + if ($run1_output === $run2_output) { + echo 'SAME OUTPUT AS PREVIOUS RUN', \PHP_EOL; + } else { + echo $run2_output; + } + + echo '=== RUNNING WITH NO LOCK ===', \PHP_EOL; + ob_start(); + set_up_db($handler, $name, LockFlag::NoLock); + run_standard_tests_ex($handler, $name, LockFlag::NoLock); + $run3_output = ob_get_clean(); + if ($run2_output === $run3_output) { + echo 'SAME OUTPUT AS PREVIOUS RUN', \PHP_EOL; + } else if ($run2_output === str_replace( // If only the fact that the lock prevented reads + 'Read during write: allowed', + 'Read during write: not allowed', + $run3_output + ) + ) { + echo 'SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock)', \PHP_EOL; + } else { + echo $run3_output; + } +} + +// TODO Array keys insertion +// TODO Run all lock flags +function set_up_cdb_db_and_run(string $name): void { + set_up_db('cdb', $name); + + $db_file = dba_open($name, 'rl', 'cdb'); + if ($db_file === false) { + die("Failed to reopen DB"); + } + for ($i = 1; $i < 6; $i++) { + echo "Key $i exists? ", dba_exists("key$i", $db_file) ? 'Y' : 'N', \PHP_EOL; + } + run_common_read_only_test($db_file); + dba_close($db_file); + + echo '--NO-LOCK--', \PHP_EOL; + cleanup_standard_db($name); + set_up_db('cdb', $name, LockFlag::NoLock); + $db_file = dba_open($name, 'r-', 'cdb'); + if ($db_file === false) { + die("Failed to reopen DB"); + } + for ($i = 1; $i < 6; $i++) { + echo "Key $i exists? ", dba_exists("key$i", $db_file) ? 'Y' : 'N', \PHP_EOL; + } + run_common_read_only_test($db_file); +} + +function cleanup_standard_db(string $name): void { + @unlink($name); + @unlink($name.'.lck'); + @unlink($name.'-lock'); +} diff --git a/ext/dba/tests/dba011.phpt b/ext/dba/tests/value_errors_open.phpt similarity index 95% rename from ext/dba/tests/dba011.phpt rename to ext/dba/tests/value_errors_open.phpt index d43a8797577..30b6fc12835 100644 --- a/ext/dba/tests/dba011.phpt +++ b/ext/dba/tests/value_errors_open.phpt @@ -116,7 +116,7 @@ database handler: flatfile resource(%d) of type (dba) === Invalid arguments dba_open() === -Warning: dba_open(): Handler "bogus" is not available in %sdba011.php on line %d +Warning: dba_open(): Handler "bogus" is not available in %s on line %d bool(false) dba_open(): Argument #1 ($path) cannot be empty dba_open(): Argument #2 ($mode) cannot be empty @@ -128,7 +128,7 @@ dba_open(): Argument #2 ($mode) cannot combine mode "-" (no lock) and "t" (test dba_open(): Argument #5 ($map_size) must be greater than or equal to 0 === Invalid arguments dba_popen() === -Warning: dba_popen(): Handler "bogus" is not available in %sdba011.php on line %d +Warning: dba_popen(): Handler "bogus" is not available in %s on line %d bool(false) dba_popen(): Argument #1 ($path) cannot be empty dba_popen(): Argument #2 ($mode) cannot be empty diff --git a/ext/pgsql/tests/80_bug14383.phpt b/ext/pgsql/tests/80_bug14383.phpt index c9848e30c1d..f17af830d70 100644 --- a/ext/pgsql/tests/80_bug14383.phpt +++ b/ext/pgsql/tests/80_bug14383.phpt @@ -5,7 +5,8 @@ dba pgsql --SKIPIF-- --FILE-- @@ -18,46 +19,65 @@ if (!$dbh) { } pg_close($dbh); -require_once(__DIR__.'/../../dba/tests/test.inc'); -require_once(__DIR__.'/../../dba/tests/dba_handler.inc'); +require_once dirname(__DIR__, 2) . '/dba/tests/setup/setup_dba_tests.inc'; +$name = 'bug14383.db'; +$handler = get_any_handler($name); +run_standard_tests($handler, $name); ?> --CLEAN-- --EXPECTF-- -database handler: %s -3NYNYY -Content String 2 -Content 2 replaced -Read during write:%sallowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { - ["key number 6"]=> - string(13) "The 6th value" - ["key2"]=> - string(27) "Content 2 replaced 2nd time" - ["key5"]=> - string(23) "The last content string" -} ---NO-LOCK-- -3NYNYY -Content String 2 +Using handler: "%s" +=== RUNNING WITH FILE LOCK === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +[key10]name10: Content String 10 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock)