summaryrefslogtreecommitdiff
path: root/ext/db
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2000-08-27 19:46:06 +0000
committerStig Bakken <ssb@php.net>2000-08-27 19:46:06 +0000
commit315f4f5658cf22a17ba06fa2ca2f3d890355873f (patch)
tree3dd1134c1d1c3821b48fab806884123f09b2d21f /ext/db
parent7eeda99a055df5a510d3d20526e9adcb42fecdb0 (diff)
downloadphp-git-315f4f5658cf22a17ba06fa2ca2f3d890355873f.tar.gz
@PHP 3 regression testing framework re-born (Stig)
Took the old PHP 3 regression testing framework and rewrote it in PHP. Should work on both Windows and UNIX, however I have not tested it on Windows. See tests/README for how to write tests. Added the PHP 3 tests and converted most of them.
Diffstat (limited to 'ext/db')
-rw-r--r--ext/db/tests/001.phpt11
-rw-r--r--ext/db/tests/002.phpt14
-rw-r--r--ext/db/tests/003.phpt15
-rw-r--r--ext/db/tests/004.phpt19
-rw-r--r--ext/db/tests/005.phpt23
-rw-r--r--ext/db/tests/006.phpt25
6 files changed, 107 insertions, 0 deletions
diff --git a/ext/db/tests/001.phpt b/ext/db/tests/001.phpt
new file mode 100644
index 0000000000..9792bfef35
--- /dev/null
+++ b/ext/db/tests/001.phpt
@@ -0,0 +1,11 @@
+--TEST--
+DBM File Creation Test
+--POST--
+--GET--
+--FILE--
+<?php
+ dbmopen("./test.dbm","n");
+ dbmclose("./test.dbm");
+?>
+--EXPECT--
+
diff --git a/ext/db/tests/002.phpt b/ext/db/tests/002.phpt
new file mode 100644
index 0000000000..99e66e9568
--- /dev/null
+++ b/ext/db/tests/002.phpt
@@ -0,0 +1,14 @@
+--TEST--
+DBM Insert/Fetch Test
+--POST--
+--GET--
+--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
+?>
+--EXPECT--
+This is a test insert
diff --git a/ext/db/tests/003.phpt b/ext/db/tests/003.phpt
new file mode 100644
index 0000000000..ec639a02a7
--- /dev/null
+++ b/ext/db/tests/003.phpt
@@ -0,0 +1,15 @@
+--TEST--
+DBM Insert/Replace/Fetch Test
+--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
+?>
+--EXPECT--
+This is the replacement text
diff --git a/ext/db/tests/004.phpt b/ext/db/tests/004.phpt
new file mode 100644
index 0000000000..561bd0be63
--- /dev/null
+++ b/ext/db/tests/004.phpt
@@ -0,0 +1,19 @@
+--TEST--
+DBM Multiple Insert/Fetch Test
+--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";
+?>
+--EXPECT--
+Another Content String Content String 2
diff --git a/ext/db/tests/005.phpt b/ext/db/tests/005.phpt
new file mode 100644
index 0000000000..90ca126272
--- /dev/null
+++ b/ext/db/tests/005.phpt
@@ -0,0 +1,23 @@
+--TEST--
+DBM FirstKey/NextKey Loop Test With 5 Items
+--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++;
+ }
+ dbmclose("./test.dbm");
+ echo $i
+?>
+--EXPECT--
+5
diff --git a/ext/db/tests/006.phpt b/ext/db/tests/006.phpt
new file mode 100644
index 0000000000..3654095a59
--- /dev/null
+++ b/ext/db/tests/006.phpt
@@ -0,0 +1,25 @@
+--TEST--
+DBM FirstKey/NextKey with 2 deletes
+--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++;
+ }
+ dbmclose("./test.dbm");
+ echo $i
+?>
+--EXPECT--
+3