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