xref: /PHP-7.1/ext/dba/tests/dba_optimize.phpt (revision 7af945e2)
1--TEST--
2DBA Optimize Test
3--SKIPIF--
4<?php
5	require_once dirname(__FILE__) .'/skipif.inc';
6	die("info $HND handler used");
7?>
8--FILE--
9<?php
10require_once(dirname(__FILE__) .'/test.inc');
11echo "database handler: $handler\n";
12if (($db_file=dba_open($db_filename, "n", $handler))!==FALSE) {
13    dba_insert("key1", "Content String 1", $db_file);
14    dba_insert("key2", "Content String 2", $db_file);
15    $a = dba_firstkey($db_file);
16    $i=0;
17    while($a) {
18        $a = dba_nextkey($db_file);
19        $i++;
20    }
21    echo $i;
22    for ($i=1; $i<3; $i++) {
23        echo dba_exists("key$i", $db_file) ? "Y" : "N";
24    }
25    echo "\n";
26    var_dump(dba_optimize());
27    var_dump(dba_optimize(""));
28    var_dump(dba_optimize($db_file));
29    dba_close($db_file);
30} else {
31    echo "Error creating database\n";
32}
33
34?>
35===DONE===
36<?php exit(0); ?>
37--CLEAN--
38<?php
39	require(dirname(__FILE__) .'/clean.inc');
40?>
41--EXPECTF--
42database handler: flatfile
432YY
44
45Warning: dba_optimize() expects exactly 1 parameter, 0 given in %sdba_optimize.php on line %d
46NULL
47
48Warning: dba_optimize() expects parameter 1 to be resource, string given in %sdba_optimize.php on line %d
49NULL
50bool(true)
51===DONE===
52