forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@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.
- Loading branch information
Showing
111 changed files
with
18,904 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 +-|= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
--- |
Oops, something went wrong.