Annotation of embedaddon/php/ext/dba/tests/dba_cdb_001.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: DBA CDB handler test
! 3: --SKIPIF--
! 4: <?php
! 5: $handler = 'cdb';
! 6: require_once(dirname(__FILE__) .'/skipif.inc');
! 7: die('info CDB does not support replace or delete');
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11:
! 12: $handler = 'cdb';
! 13: require_once(dirname(__FILE__) .'/test.inc');
! 14:
! 15: echo "Test 0\n";
! 16:
! 17: if (($db_file = dba_open($db_filename, 'n', $handler))!==FALSE) {
! 18: var_dump(dba_insert("key1", "Content String 1", $db_file));
! 19: var_dump(dba_replace("key1", "New Content String", $db_file));
! 20: var_dump(dba_fetch("key1", $db_file));
! 21: var_dump(dba_firstkey($db_file));
! 22: var_dump(dba_delete("key1", $db_file));
! 23: var_dump(dba_optimize($db_file));
! 24: var_dump(dba_sync($db_file));
! 25: dba_close($db_file);
! 26: }
! 27: else {
! 28: echo "Failed to open DB\n";
! 29: }
! 30:
! 31: unlink($db_filename);
! 32:
! 33: echo "Test 1\n";
! 34:
! 35: if (($db_file = dba_open($db_filename, 'c', $handler))!==FALSE) {
! 36: dba_insert("key1", "Content String 1", $db_file);
! 37: dba_close($db_file);
! 38: }
! 39: else {
! 40: echo "Failed to open DB\n";
! 41: }
! 42:
! 43: echo "Test 2\n";
! 44:
! 45: if (($db_file = dba_open($db_filename, 'r', $handler))!==FALSE) {
! 46: dba_insert("key1", "Content String 1", $db_file);
! 47: dba_close($db_file);
! 48: }
! 49: else {
! 50: echo "Failed to open DB\n";
! 51: }
! 52:
! 53: echo "Test 3\n";
! 54:
! 55: if (($db_file = dba_open($db_filename, 'w', $handler))!==FALSE) {
! 56: echo dba_fetch("key1", $db_file), "\n";
! 57: dba_close($db_file);
! 58: }
! 59: else {
! 60: echo "Failed to open DB\n";
! 61: }
! 62:
! 63: ?>
! 64: ===DONE===
! 65: --CLEAN--
! 66: <?php
! 67: require(dirname(__FILE__) .'/clean.inc');
! 68: ?>
! 69: --EXPECTF--
! 70: Test 0
! 71: bool(true)
! 72: bool(false)
! 73: bool(false)
! 74: bool(false)
! 75: bool(false)
! 76: bool(true)
! 77: bool(true)
! 78: Test 1
! 79:
! 80: Warning: dba_open(%stest0.dbm,c): Driver initialization failed for handler: cdb: Update operations are not supported in %sdba_cdb_001.php on line %d
! 81: Failed to open DB
! 82: Test 2
! 83:
! 84: Warning: dba_insert(): You cannot perform a modification to a database without proper access in %sdba_cdb_001.php on line %d
! 85: Test 3
! 86:
! 87: Warning: dba_open(%stest0.dbm,w): Driver initialization failed for handler: cdb: Update operations are not supported in %sdba_cdb_001.php on line %d
! 88: Failed to open DB
! 89: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>