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