xref: /php-src/ext/dba/tests/dba_gdbm.phpt (revision eddab740)
1--TEST--
2DBA GDBM handler test
3--EXTENSIONS--
4dba
5--SKIPIF--
6<?php
7require_once __DIR__ . '/setup/setup_dba_tests.inc';
8check_skip('gdbm');
9?>
10--FILE--
11<?php
12require_once __DIR__ . '/setup/setup_dba_tests.inc';
13$db_name = 'dba_gdbm.db';
14
15$handler = 'gdbm';
16run_standard_tests($handler, $db_name);
17
18?>
19--CLEAN--
20<?php
21require_once __DIR__ . '/setup/setup_dba_tests.inc';
22$db_name = 'dba_gdbm.db';
23cleanup_standard_db($db_name);
24?>
25--EXPECTF--
26=== RUNNING WITH FILE LOCK ===
27
28Notice: dba_open(): Handler gdbm does locking internally in %s on line %d
29
30Notice: dba_open(): Handler gdbm does locking internally in %s on line %d
31
32Notice: dba_open(): Handler gdbm does locking internally in %s on line %d
33Remove key 1 and 3
34bool(true)
35bool(true)
36Try to remove key 1 again
37bool(false)
38key4: Another Content String
39key2: Content String 2
40key5: The last content string
41[key10]name10: Content String 10
42name9: Content String 9
43[key30]name30: Content String 30
44Total keys: 6
45Key 1 exists? N
46Key 2 exists? Y
47Key 3 exists? N
48Key 4 exists? Y
49Key 5 exists? Y
50Replace second key data
51bool(true)
52Content 2 replaced
53Read during write: not allowed
54Expected: Added a new data entry
55Expected: Failed to insert data for already used key
56Replace second key data
57bool(true)
58Delete "key4"
59bool(true)
60Fetch "key2": Content 2 replaced 2nd time
61Fetch "key number 6": The 6th value
62
63Notice: dba_open(): Handler gdbm does locking internally in %s on line 1%d
64array(6) {
65  ["[key10]name10"]=>
66  string(17) "Content String 10"
67  ["[key30]name30"]=>
68  string(17) "Content String 30"
69  ["key number 6"]=>
70  string(13) "The 6th value"
71  ["key2"]=>
72  string(27) "Content 2 replaced 2nd time"
73  ["key5"]=>
74  string(23) "The last content string"
75  ["name9"]=>
76  string(16) "Content String 9"
77}
78=== RUNNING WITH DB LOCK (default) ===
79Remove key 1 and 3
80bool(true)
81bool(true)
82Try to remove key 1 again
83bool(false)
84key4: Another Content String
85key2: Content String 2
86key5: The last content string
87[key10]name10: Content String 10
88name9: Content String 9
89[key30]name30: Content String 30
90Total keys: 6
91Key 1 exists? N
92Key 2 exists? Y
93Key 3 exists? N
94Key 4 exists? Y
95Key 5 exists? Y
96Replace second key data
97bool(true)
98Content 2 replaced
99Read during write: not allowed
100Expected: Added a new data entry
101Expected: Failed to insert data for already used key
102Replace second key data
103bool(true)
104Delete "key4"
105bool(true)
106Fetch "key2": Content 2 replaced 2nd time
107Fetch "key number 6": The 6th value
108array(6) {
109  ["[key10]name10"]=>
110  string(17) "Content String 10"
111  ["[key30]name30"]=>
112  string(17) "Content String 30"
113  ["key number 6"]=>
114  string(13) "The 6th value"
115  ["key2"]=>
116  string(27) "Content 2 replaced 2nd time"
117  ["key5"]=>
118  string(23) "The last content string"
119  ["name9"]=>
120  string(16) "Content String 9"
121}
122=== RUNNING WITH NO LOCK ===
123
124Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d
125Failed to create DB
126