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