xref: /PHP-8.0/ext/dba/tests/dba_handlers.phpt (revision 0c6d06ec)
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(0));
39
40echo "Test 4 - full info\n";
41$h = dba_handlers(1);
42foreach ($h as $key => $val) {
43    if ($key === "flatfile") {
44        echo "Success: flatfile enabled\n";
45    }
46}
47
48?>
49--CLEAN--
50<?php
51require(__DIR__ .'/clean.inc');
52?>
53--EXPECT--
54database handler: flatfile
55Test 1
56Success: flatfile enabled
57Test 2
58Success: flatfile enabled
59Test 3
60Success: flatfile enabled
61Test 4 - full info
62Success: flatfile enabled
63