cvs: qaweb /regtests/test/ideals testdbaseaddrec.out /regtests/test/suite/bin testdbaseaddrec.php
| From: | Joey Smith | Date: | Mon, 21 Aug 2000 22:10:10 +0000 |
| Subject: | cvs: qaweb /regtests/test/ideals testdbaseaddrec.out /regtests/test/suite/bin testdbaseaddrec.php | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-911@lists.php.net to get a copy of this message | ||
joey Mon Aug 21 15:10:10 2000 EDT
Added files:
/qaweb/regtests/test/ideals testdbaseaddrec.out
/qaweb/regtests/test/suite/bin testdbaseaddrec.php
Log:
This is a test for dbase_add_record().
It opens the dbase file, adds records, closes it,
then RE-opens it and reads it all in using dbase_get_record_with_names(),
var_dump()'s the result, then closes and unlinks the dbf I created.
PROBLEM: Right now, it uses "/tmp" to create the .dbf, so it won't work on
Win32 (AFAIK).
Index: qaweb/regtests/test/ideals/testdbaseaddrec.out
+++ qaweb/regtests/test/ideals/testdbaseaddrec.out
Before anything that should crash us...
array(4) {
[1]=>
array(5) {
["code"]=>
string(12) "test "
["name_g"]=>
string(200) "test2
"
["name_r"]=>
string(200) "test3
"
["ao_dm"]=>
float(2)
["deleted"]=>
int(0)
}
[2]=>
array(5) {
["code"]=>
string(12) "test "
["name_g"]=>
string(200) "test2
"
["name_r"]=>
string(200) "test3
"
["ao_dm"]=>
float(2)
["deleted"]=>
int(0)
}
[3]=>
array(5) {
["code"]=>
string(12) "test "
["name_g"]=>
string(200) "test2
"
["name_r"]=>
string(200) "test3
"
["ao_dm"]=>
float(2)
["deleted"]=>
int(0)
}
[4]=>
array(5) {
["code"]=>
string(12) "test "
["name_g"]=>
string(200) "test2
"
["name_r"]=>
string(200) "test3
"
["ao_dm"]=>
float(2)
["deleted"]=>
int(0)
}
}
After anything that should crash us...
Index: qaweb/regtests/test/suite/bin/testdbaseaddrec.php
+++ qaweb/regtests/test/suite/bin/testdbaseaddrec.php
<?php
/**
* Test case for dbase_add_record submitted by support@webapteka.ru.
*
* This only works for Unix boxen right now, due to the use of /tmp...
* there's probably a better way to do the same thing.
*/
print "Before anything that should crash us...\n";
$dbname = "/tmp/price.dbf";
$def =
array(
array("code", "C", 12),
array("name_g", "C", 200),
array("name_r", "C", 200),
array("ao_dm", "N", 10, 2),
array("ao_dm", "N", 10, 2)
);
if (!dbase_create($dbname, $def))
{print "Create DBF Error !\n";exit(1);}
chmod($dbname,0777);
$dbf = dbase_open($dbname, 2);
if (!$dbf)
{print "Open DBF Error !\n";exit(2);}
$row = array( "test", "test2", "test3", 1, 2 );
array_keys($row);
dbase_add_record($dbf, $row);
dbase_add_record($dbf, $row);
dbase_add_record($dbf, $row);
dbase_add_record($dbf, $row);
dbase_close($dbf);
/**
* OK, now to compare...
*/
$dbf_c = dbase_open($dbname, 2);
for ($i = 1; $i <= 4; $i++)
{
$dbf_row[$i] = dbase_get_record_with_names($dbf_c, $i);
}
dbase_close($dbf_c);
unlink($dbname);
var_dump($dbf_row);
print "After anything that should crash us...\n";
?>