xref: /PHP-8.3/ext/dba/tests/dba_cdb_make.phpt (revision eddab740)
1--TEST--
2DBA CDB_MAKE handler test
3--EXTENSIONS--
4dba
5--SKIPIF--
6<?php
7require_once __DIR__ . '/setup/setup_dba_tests.inc';
8check_skip('cdb_make');
9?>
10--CONFLICTS--
11test.cdb
12--FILE--
13<?php
14    $handler = 'cdb_make';
15    $db_file = 'recreate_testcdb.cdb';
16    echo "database handler: $handler\n";
17    // print md5 checksum of test.cdb which is generated by cdb_make program
18    var_dump(md5_file(__DIR__.'/test.cdb'));
19    if (($db_make=dba_open($db_file, "n", $handler))!==FALSE) {
20        dba_insert("1", "1", $db_make);
21        dba_insert("2", "2", $db_make);
22        dba_insert("1", "3", $db_make);
23        dba_insert("2", "1", $db_make);
24        dba_insert("3", "3", $db_make);
25        dba_insert("1", "2", $db_make);
26        dba_insert("4", "4", $db_make);
27//		dba_replace cdb_make doesn't know replace
28        dba_close($db_make);
29        // write md5 checksum of generated database file
30        var_dump(md5_file($db_file));
31        // no need to test created database: this is done by dba_cdb_read.phpt
32    } else {
33        echo "Error creating database\n";
34    }
35?>
36--CLEAN--
37<?php
38require_once __DIR__ . '/setup/setup_dba_tests.inc';
39$db_name = 'recreate_testcdb.cdb';
40cleanup_standard_db($db_name);
41?>
42--EXPECT--
43database handler: cdb_make
44string(32) "12fc5ba2b9dcfef2480e5324eeb5f3e5"
45string(32) "12fc5ba2b9dcfef2480e5324eeb5f3e5"
46