xref: /PHP-8.1/ext/dba/tests/dba007.phpt (revision b5a14e6c)
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--FILE--
12<?php
13    require_once(__DIR__ .'/test.inc');
14    echo "database handler: $handler\n";
15    $db_file1 = $db_filename1 = __DIR__.'/test1.dbm';
16    $db_file2 = $db_filename2 = __DIR__.'/test2.dbm';
17    if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
18        echo "database file created\n";
19    } else {
20        echo "$db_file does not exist\n";
21    }
22    if (($db_file1=dba_open($db_file1, "n", $handler))!==FALSE) {
23        echo "database file created\n";
24    } else {
25        echo "$db_file does not exist\n";
26    }
27    if (($db_file2=dba_open($db_file2, "n", $handler))!==FALSE) {
28        echo "database file created\n";
29    } else {
30        echo "$db_file does not exist\n";
31    }
32    var_dump(dba_list());
33    dba_close($db_file);
34
35    @unlink($db_filename1);
36    @unlink($db_filename2);
37?>
38--CLEAN--
39<?php
40    require(__DIR__ .'/clean.inc');
41?>
42--EXPECTF--
43database handler: %s
44database file created
45database file created
46database file created
47array(3) {
48  [%d]=>
49  string(%d) "%stest0.dbm"
50  [%d]=>
51  string(%d) "%stest1.dbm"
52  [%d]=>
53  string(%d) "%stest2.dbm"
54}
55