Skip to content

Commit

Permalink
@php 3 regression testing framework re-born (Stig)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
stigsb committed Aug 27, 2000
1 parent 7eeda99 commit 315f4f5
Show file tree
Hide file tree
Showing 111 changed files with 18,904 additions and 74 deletions.
11 changes: 11 additions & 0 deletions ext/db/tests/001.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--TEST--
DBM File Creation Test
--POST--
--GET--
--FILE--
<?php
dbmopen("./test.dbm","n");
dbmclose("./test.dbm");
?>
--EXPECT--

14 changes: 14 additions & 0 deletions ext/db/tests/002.phpt
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions ext/db/tests/003.phpt
Original file line number Diff line number Diff line change
@@ -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
19 changes: 19 additions & 0 deletions ext/db/tests/004.phpt
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions ext/db/tests/005.phpt
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions ext/db/tests/006.phpt
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions ext/ereg/tests/001.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--TEST--
RegReplace test 1
--POST--
--GET--
--FILE--
<?php $a="abc123";
echo ereg_replace("123","def",$a)?>
--EXPECT--
abcdef
9 changes: 9 additions & 0 deletions ext/ereg/tests/002.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--TEST--
RegReplace test 2
--POST--
--GET--
--FILE--
<?php $a="abc123";
echo ereg_replace("123","",$a)?>
--EXPECT--
abc
11 changes: 11 additions & 0 deletions ext/ereg/tests/003.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--TEST--
ereg_replace single-quote test
--POST--
--GET--
--FILE--
<?php $a="\\'test";
echo ereg_replace("\\\\'","'",$a)
?>
--EXPECT--

'test
16 changes: 16 additions & 0 deletions ext/ereg/tests/004.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
simple ereg test
--POST--
--GET--
--FILE--
<?php $a="This is a nice and simple string";
if (ereg(".*nice and simple.*",$a)) {
echo "ok\n";
}
if (!ereg(".*doesn't exist.*",$a)) {
echo "ok\n";
}
?>
--EXPECT--
ok
ok
20 changes: 20 additions & 0 deletions ext/ereg/tests/005.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
Test Regular expression register support in ereg
--POST--
--GET--
--FILE--
<?php $a="This is a nice and simple string";
echo ereg(".*(is).*(is).*",$a,$registers);
echo "\n";
echo $registers[0];
echo "\n";
echo $registers[1];
echo "\n";
echo $registers[2];
echo "\n";
?>
--EXPECT--
32
This is a nice and simple string
is
is
10 changes: 10 additions & 0 deletions ext/ereg/tests/006.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--TEST--
Test ereg_replace of start-of-line
--POST--
--GET--
--FILE--
<?php $a="This is a nice and simple string";
echo ereg_replace("^This","That",$a);
?>
--EXPECT--
That is a nice and simple string
12 changes: 12 additions & 0 deletions ext/ereg/tests/007.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--TEST--
Test empty result buffer in reg_replace
--POST--
--GET--
--FILE--
<?php
$a="abcd";
$b=ereg_replace("abcd","",$a);
echo strlen($b);
?>
--EXPECT--
0
10 changes: 10 additions & 0 deletions ext/ereg/tests/008.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--TEST--
Test back-references in regular expressions
--POST--
--GET--
--FILE--
<?php
echo ereg_replace("([a-z]*)([-=+|]*)([0-9]+)","\\3 \\1 \\2\n","abc+-|=123");
?>
--EXPECT--
123 abc +-|=
19 changes: 19 additions & 0 deletions ext/ereg/tests/009.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
Test split()
--POST--
--GET--
--FILE--
<?php
$a=split("[[:space:]]","this is a
test");
echo count($a) . "\n";
for ($i = 0; $i < count($a); $i++) {
echo $a[$i] . "\n";
}
?>
--EXPECT--
4
this
is
a
test
9 changes: 9 additions & 0 deletions ext/ereg/tests/010.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--TEST--
Long back references
--POST--
--GET--
--FILE--
<?php $a="abc122222222223";
echo ereg_replace("1(2*)3","\\1def\\1",$a)?>
--EXPECT--
abc2222222222def2222222222
9 changes: 9 additions & 0 deletions ext/ereg/tests/011.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--TEST--
\0 back reference
--POST--
--GET--
--FILE--
<?php $a="abc123";
echo ereg_replace("123","def\\0ghi",$a)?>
--EXPECT--
abcdef123ghi
9 changes: 9 additions & 0 deletions ext/ereg/tests/012.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--TEST--
nonexisting back reference
--POST--
--GET--
--FILE--
<?php $a="abc123";
echo ereg_replace("123",'def\1ghi',$a)?>
--EXPECT--
abcdef\1ghi
9 changes: 9 additions & 0 deletions ext/ereg/tests/013.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--TEST--
escapes in replace string
--POST--
--GET--
--FILE--
<?php $a="abc123";
echo ereg_replace("123","def\\g\\\\hi\\",$a)?>
--EXPECT--
abcdef\g\\hi\
9 changes: 9 additions & 0 deletions ext/ereg/tests/014.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
--TEST--
backreferences not replaced recursively
--POST--
--GET--
--FILE--
<?php $a="a\\2bxc";
echo ereg_replace("a(.*)b(.*)c","\\1",$a)?>
--EXPECT--
\2
8 changes: 8 additions & 0 deletions ext/ereg/tests/015.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--TEST--
replace empty matches
--POST--
--GET--
--FILE--
<?php echo ereg_replace("^","z","abc123")?>
--EXPECT--
zabc123
8 changes: 8 additions & 0 deletions ext/ereg/tests/016.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--TEST--
test backslash handling in regular expressions
--POST--
--GET--
--FILE--
<?php echo ereg_replace('\?',"abc","?123?")?>
--EXPECT--
abc123abc
34 changes: 34 additions & 0 deletions ext/interbase/tests/001.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
--TEST--
InterBase: create test database
--SKIPIF--
<?php if (!extension_loaded("interbase")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?
/* $Id$ */

$test_base = "ibase_test.tmp";
$name = tempnam("","CREATEDB");
$ftmp = fopen($name,"w");
if (is_file($test_base))
fwrite($ftmp,
"connect \"$test_base\";
drop database;\n"
);
fwrite($ftmp,
"create database \"$test_base\";
create table test1 (
i integer,
c varchar(100)
);
commit;
insert into test1(i, c) values(1, 'test table created with isql');
exit;\n"
);
fclose($ftmp);
exec("isql -i $name 2>&1");
unlink($name);
?>
--EXPECT--

35 changes: 35 additions & 0 deletions ext/interbase/tests/002.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
--TEST--
InterBase: connect, close and pconnect
--SKIPIF--
<?php if (!extension_loaded("interbase")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?
/* $Id$ */

require("interbase/interbase.inc");

$test_base = "ibase_test.tmp";

ibase_connect($test_base);
out_table("test1");
ibase_close();

$con = ibase_connect($test_base);
$pcon1 = ibase_pconnect($test_base);
$pcon2 = ibase_pconnect($test_base);
ibase_close($con);
ibase_close($pcon1);

out_table("test1");

ibase_close($pcon2);
?>
--EXPECT--
--- test1 ---
1 test table created with isql
---
--- test1 ---
1 test table created with isql
---
Loading

0 comments on commit 315f4f5

Please sign in to comment.