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