xref: /PHP-8.2/ext/dba/tests/dba_dbm.phpt (revision eddab740)
1--TEST--
2DBA DBM handler test
3--EXTENSIONS--
4dba
5--SKIPIF--
6<?php
7require_once __DIR__ . '/setup/setup_dba_tests.inc';
8check_skip('dbm');
9?>
10--FILE--
11<?php
12require_once __DIR__ . '/setup/setup_dba_tests.inc';
13$db_name = 'dba_dbm.db';
14
15$handler = 'dbm';
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_dbm.db';
24cleanup_standard_db($db_name);
25?>
26--EXPECT--
27key4: Another Content String
28key2: Content String 2
29key5: The last content string
30Total keys: 3
31Key 1 exists? N
32Key 2 exists? Y
33Key 3 exists? N
34Key 4 exists? Y
35Key 5 exists? Y
36Content 2 replaced
37Read during write: not allowed
38Expected: Added a new data entry
39Expected: Failed to insert data for already used key
40Delete "key4"
41Fetch "key2": Content 2 replaced 2nd time
42Fetch "key number 6": The 6th value
43array(3) {
44  ["key number 6"]=>
45  string(13) "The 6th value"
46  ["key2"]=>
47  string(27) "Content 2 replaced 2nd time"
48  ["key5"]=>
49  string(23) "The last content string"
50}
51