xref: /PHP-8.3/ext/dba/tests/dba007.phpt (revision eddab740)
1--TEST--
2DBA Multiple File Creation Test
3--EXTENSIONS--
4dba
5--SKIPIF--
6<?php
7    require_once(__DIR__ .'/skipif.inc');
8    if (!function_exists('dba_list')) die('skip dba_list() not available');
9    die("info $HND handler used");
10?>
11--CONFLICTS--
12dba
13--FILE--
14<?php
15    require_once(__DIR__ .'/test.inc');
16    echo "database handler: $handler\n";
17    $db_file1 = $db_filename1 = __DIR__.'/test1.dbm';
18    $db_file2 = $db_filename2 = __DIR__.'/test2.dbm';
19    if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
20        echo "database file created\n";
21    } else {
22        echo "$db_file does not exist\n";
23    }
24    if (($db_file1=dba_open($db_file1, "n", $handler))!==FALSE) {
25        echo "database file created\n";
26    } else {
27        echo "$db_file does not exist\n";
28    }
29    if (($db_file2=dba_open($db_file2, "n", $handler))!==FALSE) {
30        echo "database file created\n";
31    } else {
32        echo "$db_file does not exist\n";
33    }
34    var_dump(dba_list());
35    dba_close($db_file);
36
37    @unlink($db_filename1);
38    @unlink($db_filename2);
39?>
40--CLEAN--
41<?php
42    require(__DIR__ .'/clean.inc');
43?>
44--EXPECTF--
45database handler: %s
46database file created
47database file created
48database file created
49array(3) {
50  [%d]=>
51  string(%d) "%stest0.dbm"
52  [%d]=>
53  string(%d) "%stest1.dbm"
54  [%d]=>
55  string(%d) "%stest2.dbm"
56}
57