xref: /PHP-7.4/ext/dba/tests/dba_handlers.phpt (revision 26dfce7f)
1--TEST--
2DBA Handler Test
3--SKIPIF--
4<?php
5$handler="flatfile";
6require(__DIR__ .'/skipif.inc');
7die("info $HND handler used");
8?>
9--FILE--
10<?php
11$handler="flatfile";
12require_once(__DIR__ .'/test.inc');
13echo "database handler: $handler\n";
14
15function check($h)
16{
17    if (!$h) {
18        return;
19    }
20
21    foreach ($h as $key) {
22        if ($key === "flatfile") {
23            echo "Success: flatfile enabled\n";
24        }
25    }
26}
27
28echo "Test 1\n";
29
30check(dba_handlers());
31
32echo "Test 2\n";
33
34check(dba_handlers(null));
35
36echo "Test 3\n";
37
38check(dba_handlers(1, 2));
39
40echo "Test 4\n";
41
42check(dba_handlers(0));
43
44echo "Test 5 - 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--EXPECTF--
58database handler: flatfile
59Test 1
60Success: flatfile enabled
61Test 2
62Success: flatfile enabled
63Test 3
64
65Warning: dba_handlers() expects at most 1 parameter, 2 given in %sdba_handlers.php on line %d
66Test 4
67Success: flatfile enabled
68Test 5 - full info
69Success: flatfile enabled
70