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