cvs: php4 /ext/db/tests 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt 006.phpt test.inc

From: Date: Tue, 22 Oct 2002 18:40:31 +0000
Subject: cvs: php4 /ext/db/tests 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt 006.phpt test.inc
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-15158@lists.php.net to get a copy of this message
helly Tue Oct 22 14:40:31 2002 EDT Added files: /php4/ext/db/tests test.inc Modified files: /php4/ext/db/tests 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt 006.phpt Log: Updated tests Index: php4/ext/db/tests/001.phpt diff -u php4/ext/db/tests/001.phpt:1.2 php4/ext/db/tests/001.phpt:1.3 --- php4/ext/db/tests/001.phpt:1.2 Mon Oct 23 03:40:05 2000 +++ php4/ext/db/tests/001.phpt Tue Oct 22 14:40:30 2002 @@ -2,12 +2,15 @@ DBM File Creation Test --SKIPIF-- <?php if (!extension_loaded("db")) print "skip"; ?> ---POST-- ---GET-- --FILE-- <?php - dbmopen("./test.dbm","n"); - dbmclose("./test.dbm"); + require_once('test.inc'); + if (dbmopen($db_file, "n") && file_exists($db_file)) { + echo "database file created\n"; + } else { + echo "$db_file does not exist\n"; + } + dbmclose($db_file); ?> --EXPECT-- - +database file created \ No newline at end of file Index: php4/ext/db/tests/002.phpt diff -u php4/ext/db/tests/002.phpt:1.2 php4/ext/db/tests/002.phpt:1.3 --- php4/ext/db/tests/002.phpt:1.2 Mon Oct 23 03:40:05 2000 +++ php4/ext/db/tests/002.phpt Tue Oct 22 14:40:30 2002 @@ -1,16 +1,17 @@ --TEST-- DBM Insert/Fetch Test --SKIPIF-- -<?php if (!extension_loaded("db")) print "skip"; ?> ---POST-- ---GET-- +<?php if (!extension_loaded("db")) print "skip";?> --FILE-- <?php - dbmopen("./test.dbm","n"); - dbminsert("./test.dbm","key1","This is a test insert"); - $a = dbmfetch("./test.dbm","key1"); - dbmclose("./test.dbm"); - echo $a + require_once('test.inc'); + if (dbmopen($db_file, "n")) { + dbminsert($db_file, "key1", "This is a test insert"); + echo dbmfetch($db_file, "key1"); + dbmclose($db_file); + } else { + echo "Error creating database\n"; + } ?> --EXPECT-- This is a test insert Index: php4/ext/db/tests/003.phpt diff -u php4/ext/db/tests/003.phpt:1.2 php4/ext/db/tests/003.phpt:1.3 --- php4/ext/db/tests/003.phpt:1.2 Mon Oct 23 03:40:05 2000 +++ php4/ext/db/tests/003.phpt Tue Oct 22 14:40:30 2002 @@ -2,16 +2,18 @@ DBM Insert/Replace/Fetch Test --SKIPIF-- <?php if (!extension_loaded("db")) print "skip"; ?> ---POST-- ---GET-- --FILE-- <?php - dbmopen("./test.dbm","n"); - dbminsert("./test.dbm","key1","This is a test insert"); - dbmreplace("./test.dbm","key1","This is the replacement text"); - $a = dbmfetch("./test.dbm","key1"); - dbmclose("./test.dbm"); - echo $a + require_once('test.inc'); + if (dbmopen($db_file, "n")) { + dbminsert($db_file, "key1", "This is a test insert"); + dbmreplace($db_file, "key1", "This is the replacement text"); + $a = dbmfetch($db_file, "key1"); + dbmclose($db_file); + echo $a; + } else { + echo "Error creating database\n"; + } ?> --EXPECT-- This is the replacement text Index: php4/ext/db/tests/004.phpt diff -u php4/ext/db/tests/004.phpt:1.2 php4/ext/db/tests/004.phpt:1.3 --- php4/ext/db/tests/004.phpt:1.2 Mon Oct 23 03:40:05 2000 +++ php4/ext/db/tests/004.phpt Tue Oct 22 14:40:30 2002 @@ -2,20 +2,22 @@ DBM Multiple Insert/Fetch Test --SKIPIF-- <?php if (!extension_loaded("db")) print "skip"; ?> ---POST-- ---GET-- --FILE-- <?php - dbmopen("./test.dbm","n"); - dbminsert("./test.dbm","key1","Content String 1"); - dbminsert("./test.dbm","key2","Content String 2"); - dbminsert("./test.dbm","key3","Third Content String"); - dbminsert("./test.dbm","key4","Another Content String"); - dbminsert("./test.dbm","key5","The last content string"); - $a = dbmfetch("./test.dbm","key4"); - $b = dbmfetch("./test.dbm","key2"); - dbmclose("./test.dbm"); - echo "$a $b"; + require_once('test.inc'); + if (dbmopen($db_file, "n")) { + dbminsert($db_file, "key1", "Content String 1"); + dbminsert($db_file, "key2", "Content String 2"); + dbminsert($db_file, "key3", "Third Content String"); + dbminsert($db_file, "key4", "Another Content String"); + dbminsert($db_file, "key5", "The last content string"); + $a = dbmfetch($db_file, "key4"); + $b = dbmfetch($db_file, "key2"); + dbmclose($db_file); + echo "$a $b"; + } else { + echo "Error creating database\n"; + } ?> --EXPECT-- Another Content String Content String 2 Index: php4/ext/db/tests/005.phpt diff -u php4/ext/db/tests/005.phpt:1.2 php4/ext/db/tests/005.phpt:1.3 --- php4/ext/db/tests/005.phpt:1.2 Mon Oct 23 03:40:05 2000 +++ php4/ext/db/tests/005.phpt Tue Oct 22 14:40:30 2002 @@ -2,24 +2,26 @@ DBM FirstKey/NextKey Loop Test With 5 Items --SKIPIF-- <?php if (!extension_loaded("db")) print "skip"; ?> ---POST-- ---GET-- --FILE-- <?php - dbmopen("./test.dbm","n"); - dbminsert("./test.dbm","key1","Content String 1"); - dbminsert("./test.dbm","key2","Content String 2"); - dbminsert("./test.dbm","key3","Third Content String"); - dbminsert("./test.dbm","key4","Another Content String"); - dbminsert("./test.dbm","key5","The last content string"); - $a = dbmfirstkey("./test.dbm"); - $i=0; - while($a) { - $a = dbmnextkey("./test.dbm",$a); - $i++; + require_once('test.inc'); + if (dbmopen($db_file, "n")) { + dbminsert($db_file, "key1", "Content String 1"); + dbminsert($db_file, "key2", "Content String 2"); + dbminsert($db_file, "key3", "Third Content String"); + dbminsert($db_file, "key4", "Another Content String"); + dbminsert($db_file, "key5", "The last content string"); + $a = dbmfirstkey($db_file); + $i=0; + while($a) { + $a = dbmnextkey($db_file, $a); + $i++; + } + dbmclose($db_file); + echo $i; + } else { + echo "Error creating database\n"; } - dbmclose("./test.dbm"); - echo $i ?> --EXPECT-- 5 Index: php4/ext/db/tests/006.phpt diff -u php4/ext/db/tests/006.phpt:1.2 php4/ext/db/tests/006.phpt:1.3 --- php4/ext/db/tests/006.phpt:1.2 Mon Oct 23 03:40:05 2000 +++ php4/ext/db/tests/006.phpt Tue Oct 22 14:40:30 2002 @@ -2,26 +2,28 @@ DBM FirstKey/NextKey with 2 deletes --SKIPIF-- <?php if (!extension_loaded("db")) print "skip"; ?> ---POST-- ---GET-- --FILE-- <?php - dbmopen("./test.dbm","n"); - dbminsert("./test.dbm","key1","Content String 1"); - dbminsert("./test.dbm","key2","Content String 2"); - dbminsert("./test.dbm","key3","Third Content String"); - dbminsert("./test.dbm","key4","Another Content String"); - dbminsert("./test.dbm","key5","The last content string"); - dbmdelete("./test.dbm","key3"); - dbmdelete("./test.dbm","key1"); - $a = dbmfirstkey("./test.dbm"); - $i=0; - while($a) { - $a = dbmnextkey("./test.dbm",$a); - $i++; + require_once('test.inc'); + if (dbmopen($db_file, "n")) { + dbminsert($db_file, "key1", "Content String 1"); + dbminsert($db_file, "key2", "Content String 2"); + dbminsert($db_file, "key3", "Third Content String"); + dbminsert($db_file, "key4", "Another Content String"); + dbminsert($db_file, "key5", "The last content string"); + dbmdelete($db_file, "key3"); + dbmdelete($db_file, "key1"); + $a = dbmfirstkey($db_file); + $i=0; + while($a) { + $a = dbmnextkey($db_file, $a); + $i++; + } + dbmclose($db_file); + echo $i; + } else { + echo "Error creating database\n"; } - dbmclose("./test.dbm"); - echo $i ?> --EXPECT-- 3 Index: php4/ext/db/tests/test.inc +++ php4/ext/db/tests/test.inc <?php $db_file = dirname(__FILE__).'/test.dbm'; ?>

« previous php.cvs (#15158) next »