xref: /PHP-8.4/ext/dba/tests/dba_handlers.phpt (revision 184ffe23)
1--TEST--
2DBA Handler Test
3--EXTENSIONS--
4dba
5--CONFLICTS--
6dba
7--SKIPIF--
8<?php
9$handler="flatfile";
10require(__DIR__ .'/skipif.inc');
11die("info $HND handler used");
12?>
13--FILE--
14<?php
15$handler="flatfile";
16require_once(__DIR__ .'/test.inc');
17echo "database handler: $handler\n";
18
19function check($h)
20{
21    if (!$h) {
22        return;
23    }
24
25    foreach ($h as $key) {
26        if ($key === "flatfile") {
27            echo "Success: flatfile enabled\n";
28        }
29    }
30}
31
32echo "Test 1\n";
33
34check(dba_handlers());
35
36echo "Test 2\n";
37
38check(dba_handlers(false));
39
40echo "Test 3\n";
41
42check(dba_handlers(0));
43
44echo "Test 4 - full info\n";
45$h = dba_handlers(1);
46foreach ($h as $key => $val) {
47    if ($key === "flatfile") {
48        echo "Success: flatfile enabled\n";
49    }
50}
51
52?>
53--CLEAN--
54<?php
55require(__DIR__ .'/clean.inc');
56?>
57--EXPECT--
58database handler: flatfile
59Test 1
60Success: flatfile enabled
61Test 2
62Success: flatfile enabled
63Test 3
64Success: flatfile enabled
65Test 4 - full info
66Success: flatfile enabled
67