summaryrefslogtreecommitdiff
path: root/ext
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
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')
-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
-rw-r--r--ext/ereg/tests/001.phpt9
-rw-r--r--ext/ereg/tests/002.phpt9
-rw-r--r--ext/ereg/tests/003.phpt11
-rw-r--r--ext/ereg/tests/004.phpt16
-rw-r--r--ext/ereg/tests/005.phpt20
-rw-r--r--ext/ereg/tests/006.phpt10
-rw-r--r--ext/ereg/tests/007.phpt12
-rw-r--r--ext/ereg/tests/008.phpt10
-rw-r--r--ext/ereg/tests/009.phpt19
-rw-r--r--ext/ereg/tests/010.phpt9
-rw-r--r--ext/ereg/tests/011.phpt9
-rw-r--r--ext/ereg/tests/012.phpt9
-rw-r--r--ext/ereg/tests/013.phpt9
-rw-r--r--ext/ereg/tests/014.phpt9
-rw-r--r--ext/ereg/tests/015.phpt8
-rw-r--r--ext/ereg/tests/016.phpt8
-rw-r--r--ext/interbase/tests/001.phpt34
-rw-r--r--ext/interbase/tests/002.phpt35
-rw-r--r--ext/interbase/tests/003.phpt93
-rw-r--r--ext/interbase/tests/004.phpt179
-rw-r--r--ext/interbase/tests/005.phpt275
-rw-r--r--ext/interbase/tests/006.phpt227
-rwxr-xr-xext/interbase/tests/extension1
-rwxr-xr-xext/interbase/tests/interbase.inc77
-rw-r--r--ext/standard/tests/file/001.phpt141
-rw-r--r--ext/standard/tests/general_functions/001.phpt55
-rw-r--r--ext/standard/tests/math/001.phpt25
-rw-r--r--ext/standard/tests/reg/001.phpt9
-rw-r--r--ext/standard/tests/reg/002.phpt9
-rw-r--r--ext/standard/tests/reg/003.phpt11
-rw-r--r--ext/standard/tests/reg/004.phpt16
-rw-r--r--ext/standard/tests/reg/005.phpt20
-rw-r--r--ext/standard/tests/reg/006.phpt10
-rw-r--r--ext/standard/tests/reg/007.phpt12
-rw-r--r--ext/standard/tests/reg/008.phpt10
-rw-r--r--ext/standard/tests/reg/009.phpt19
-rw-r--r--ext/standard/tests/reg/010.phpt9
-rw-r--r--ext/standard/tests/reg/011.phpt9
-rw-r--r--ext/standard/tests/reg/012.phpt9
-rw-r--r--ext/standard/tests/reg/013.phpt9
-rw-r--r--ext/standard/tests/reg/014.phpt9
-rw-r--r--ext/standard/tests/reg/015.phpt8
-rw-r--r--ext/standard/tests/reg/016.phpt8
49 files changed, 1603 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
diff --git a/ext/ereg/tests/001.phpt b/ext/ereg/tests/001.phpt
new file mode 100644
index 0000000000..f63c252518
--- /dev/null
+++ b/ext/ereg/tests/001.phpt
@@ -0,0 +1,9 @@
+--TEST--
+RegReplace test 1
+--POST--
+--GET--
+--FILE--
+<?php $a="abc123";
+ echo ereg_replace("123","def",$a)?>
+--EXPECT--
+abcdef
diff --git a/ext/ereg/tests/002.phpt b/ext/ereg/tests/002.phpt
new file mode 100644
index 0000000000..a9b7aaa00a
--- /dev/null
+++ b/ext/ereg/tests/002.phpt
@@ -0,0 +1,9 @@
+--TEST--
+RegReplace test 2
+--POST--
+--GET--
+--FILE--
+<?php $a="abc123";
+ echo ereg_replace("123","",$a)?>
+--EXPECT--
+abc
diff --git a/ext/ereg/tests/003.phpt b/ext/ereg/tests/003.phpt
new file mode 100644
index 0000000000..bb42729ca2
--- /dev/null
+++ b/ext/ereg/tests/003.phpt
@@ -0,0 +1,11 @@
+--TEST--
+ereg_replace single-quote test
+--POST--
+--GET--
+--FILE--
+<?php $a="\\'test";
+ echo ereg_replace("\\\\'","'",$a)
+?>
+--EXPECT--
+
+'test
diff --git a/ext/ereg/tests/004.phpt b/ext/ereg/tests/004.phpt
new file mode 100644
index 0000000000..1f60ff4900
--- /dev/null
+++ b/ext/ereg/tests/004.phpt
@@ -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
diff --git a/ext/ereg/tests/005.phpt b/ext/ereg/tests/005.phpt
new file mode 100644
index 0000000000..78c0a0912a
--- /dev/null
+++ b/ext/ereg/tests/005.phpt
@@ -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
diff --git a/ext/ereg/tests/006.phpt b/ext/ereg/tests/006.phpt
new file mode 100644
index 0000000000..50b6dbfd3a
--- /dev/null
+++ b/ext/ereg/tests/006.phpt
@@ -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
diff --git a/ext/ereg/tests/007.phpt b/ext/ereg/tests/007.phpt
new file mode 100644
index 0000000000..2223d48e22
--- /dev/null
+++ b/ext/ereg/tests/007.phpt
@@ -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
diff --git a/ext/ereg/tests/008.phpt b/ext/ereg/tests/008.phpt
new file mode 100644
index 0000000000..db61d1ca07
--- /dev/null
+++ b/ext/ereg/tests/008.phpt
@@ -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 +-|=
diff --git a/ext/ereg/tests/009.phpt b/ext/ereg/tests/009.phpt
new file mode 100644
index 0000000000..4996ef4c97
--- /dev/null
+++ b/ext/ereg/tests/009.phpt
@@ -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
diff --git a/ext/ereg/tests/010.phpt b/ext/ereg/tests/010.phpt
new file mode 100644
index 0000000000..30d28fd02f
--- /dev/null
+++ b/ext/ereg/tests/010.phpt
@@ -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
diff --git a/ext/ereg/tests/011.phpt b/ext/ereg/tests/011.phpt
new file mode 100644
index 0000000000..4eda774f58
--- /dev/null
+++ b/ext/ereg/tests/011.phpt
@@ -0,0 +1,9 @@
+--TEST--
+\0 back reference
+--POST--
+--GET--
+--FILE--
+<?php $a="abc123";
+ echo ereg_replace("123","def\\0ghi",$a)?>
+--EXPECT--
+abcdef123ghi
diff --git a/ext/ereg/tests/012.phpt b/ext/ereg/tests/012.phpt
new file mode 100644
index 0000000000..d5342c7436
--- /dev/null
+++ b/ext/ereg/tests/012.phpt
@@ -0,0 +1,9 @@
+--TEST--
+nonexisting back reference
+--POST--
+--GET--
+--FILE--
+<?php $a="abc123";
+ echo ereg_replace("123",'def\1ghi',$a)?>
+--EXPECT--
+abcdef\1ghi
diff --git a/ext/ereg/tests/013.phpt b/ext/ereg/tests/013.phpt
new file mode 100644
index 0000000000..ec3329fa7c
--- /dev/null
+++ b/ext/ereg/tests/013.phpt
@@ -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\
diff --git a/ext/ereg/tests/014.phpt b/ext/ereg/tests/014.phpt
new file mode 100644
index 0000000000..ec4d19ed0e
--- /dev/null
+++ b/ext/ereg/tests/014.phpt
@@ -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
diff --git a/ext/ereg/tests/015.phpt b/ext/ereg/tests/015.phpt
new file mode 100644
index 0000000000..961a60fa76
--- /dev/null
+++ b/ext/ereg/tests/015.phpt
@@ -0,0 +1,8 @@
+--TEST--
+replace empty matches
+--POST--
+--GET--
+--FILE--
+<?php echo ereg_replace("^","z","abc123")?>
+--EXPECT--
+zabc123
diff --git a/ext/ereg/tests/016.phpt b/ext/ereg/tests/016.phpt
new file mode 100644
index 0000000000..a24816f182
--- /dev/null
+++ b/ext/ereg/tests/016.phpt
@@ -0,0 +1,8 @@
+--TEST--
+test backslash handling in regular expressions
+--POST--
+--GET--
+--FILE--
+<?php echo ereg_replace('\?',"abc","?123?")?>
+--EXPECT--
+abc123abc
diff --git a/ext/interbase/tests/001.phpt b/ext/interbase/tests/001.phpt
new file mode 100644
index 0000000000..79263d6f5c
--- /dev/null
+++ b/ext/interbase/tests/001.phpt
@@ -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--
+
diff --git a/ext/interbase/tests/002.phpt b/ext/interbase/tests/002.phpt
new file mode 100644
index 0000000000..6ea1b498ba
--- /dev/null
+++ b/ext/interbase/tests/002.phpt
@@ -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
+---
diff --git a/ext/interbase/tests/003.phpt b/ext/interbase/tests/003.phpt
new file mode 100644
index 0000000000..5398b52850
--- /dev/null
+++ b/ext/interbase/tests/003.phpt
@@ -0,0 +1,93 @@
+--TEST--
+InterBase: misc sql types (may take a while)
+--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);
+
+ ibase_query(
+ "create table test3 (
+ iter integer,
+ v_char char(1000),
+ v_date date,
+ v_decimal decimal(12,3),
+ v_double double precision,
+ v_float float,
+ v_integer integer,
+ v_numeric numeric(4,2),
+ v_smallint smallint,
+ v_varchar varchar(10000)
+ )");
+ ibase_commit();
+
+ /* if timefmt is not supported, suppress error here*/
+ @ibase_timefmt("%m/%d/%Y %H:%M:%S");
+
+ for($iter = 0; $iter < 10; $iter++){
+ /* prepare data */
+ $v_char = rand_str(1000);
+ $v_date = rand_datetime();
+ $v_decimal = rand_number(12,3);
+ $v_double = rand_number(20);
+ $v_float = rand_number(7);
+ $v_integer = rand_number(9,0);
+ $v_numeric = rand_number(4,2);
+ $v_smallint = rand_number(5) % 32767;
+ $v_varchar = rand_str(10000);
+
+ ibase_query(
+ "insert into test3 (iter, v_char,v_date,v_decimal,v_double,v_float,v_integer,v_numeric,v_smallint,v_varchar)
+ values ($iter, '$v_char','$v_date',$v_decimal,$v_double,$v_float,$v_integer,$v_numeric,$v_smallint,'$v_varchar')");
+ $sel = ibase_query("select * from test3 where iter = $iter");
+
+ $row = ibase_fetch_object($sel);
+ if(substr($row->V_CHAR,0,strlen($v_char)) != $v_char){
+ echo " CHAR fail:\n";
+ echo " in: $v_char\n";
+ echo " out: $row->V_CHAR\n";
+ }
+ if($row->V_DATE != $v_date){
+ echo " DATE fail\n";
+ echo " in: $v_date\n";
+ echo " out: $row->V_DATE\n";
+ }
+ if($row->V_DECIMAL != $v_decimal){
+ echo " DECIMAL fail\n";
+ echo " in: $v_decimal\n";
+ echo " out: $row->V_DECIMAL\n";
+ }
+ if(abs($row->V_DOUBLE - $v_double) > abs($v_double / 1E15)){
+ echo " DOUBLE fail\n";
+ echo " in: $v_double\n";
+ echo " out: $row->V_DOUBLE\n";
+ }
+ if(abs($row->V_FLOAT - $v_float) > abs($v_float / 1E7)){
+ echo " FLOAT fail\n";
+ echo " in: $v_float\n";
+ echo " out: $row->V_FLOAT\n";
+ }
+ if($row->V_INTEGER != $v_integer){
+ echo " INTEGER fail\n";
+ echo " in: $v_integer\n";
+ echo " out: $row->V_INTEGER\n";
+ }
+ ibase_free_result($sel);
+ }/* for($iter)*/
+
+ ibase_close();
+ echo "end of test\n";
+?>
+--EXPECT--
+
+end of test
+
+
diff --git a/ext/interbase/tests/004.phpt b/ext/interbase/tests/004.phpt
new file mode 100644
index 0000000000..04df7ae991
--- /dev/null
+++ b/ext/interbase/tests/004.phpt
@@ -0,0 +1,179 @@
+--TEST--
+InterBase: BLOB test
+--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);
+
+ ibase_query(
+ "create table test4 (
+ v_integer integer,
+ v_blob blob)");
+ ibase_commit();
+
+ /* create 10k blob file */
+ $blob_str = rand_binstr(10*1024);
+
+ $name = tempnam("","blob.tmp");
+ $name = "blob.tmp";
+ $ftmp = fopen($name,"w");
+ fwrite($ftmp,$blob_str);
+ fclose($ftmp);
+
+ echo "import blob 1\n";
+ $ftmp = fopen($name,"r");
+ $bl_s = ibase_blob_import($ftmp);
+ ibase_query("insert into test4 (v_integer, v_blob) values (1, ?)", $bl_s);
+
+ echo "test blob 1\n";
+ $q = ibase_query("select v_blob from test4 where v_integer = 1");
+ $row = ibase_fetch_object($q);
+ $bl_h = ibase_blob_open($row->V_BLOB);
+
+ while($piece = ibase_blob_get($bl_h, rand() % 1024))
+ $blob .= $piece;
+ if($blob != $blob_str)
+ echo " BLOB 1 fail\n";
+ ibase_blob_close($bl_h);
+ ibase_free_result($q);
+ unset($blob);
+
+ echo "create blob 2\n";
+
+ $bl_h = ibase_blob_create();
+ $ftmp = fopen($name,"r");
+ while($piece = fread($ftmp, rand() % 1024)){
+ ibase_blob_add($bl_h, $piece);
+ }
+ fclose($ftmp);
+ $bl_s = ibase_blob_close($bl_h);
+ ibase_query("insert into test4 (v_integer, v_blob) values (2, ?)", $bl_s);
+
+ echo "test blob 2\n";
+
+ $q = ibase_query("select v_blob from test4 where v_integer = 2");
+ $row = ibase_fetch_object($q);
+ $bl_h = ibase_blob_open($row->V_BLOB);
+ while($piece = ibase_blob_get($bl_h, rand() % 1024))
+ $blob .= $piece;
+ if($blob != $blob_str)
+ echo " BLOB 2 fail\n";
+ ibase_blob_close($bl_h);
+ ibase_free_result($q);
+ unset($blob);
+
+
+ echo "create blob 3\n";
+
+ $bl_h = ibase_blob_create();
+
+ ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
+ ibase_blob_add($bl_h, "| PHP HTML Embedded Scripting Language Version 3.0 |\n");
+ ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
+ ibase_blob_add($bl_h, "| Copyright (c) 1997-2000 PHP Development Team (See Credits file) |\n");
+ ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
+ ibase_blob_add($bl_h, "| This program is free software; you can redistribute it and/or modify |\n");
+ ibase_blob_add($bl_h, "| it under the terms of one of the following licenses: |\n");
+ ibase_blob_add($bl_h, "| |\n");
+ ibase_blob_add($bl_h, "| A) the GNU General Public License as published by the Free Software |\n");
+ ibase_blob_add($bl_h, "| Foundation; either version 2 of the License, or (at your option) |\n");
+ ibase_blob_add($bl_h, "| any later version. |\n");
+ ibase_blob_add($bl_h, "| |\n");
+ ibase_blob_add($bl_h, "| B) the PHP License as published by the PHP Development Team and |\n");
+ ibase_blob_add($bl_h, "| included in the distribution in the file: LICENSE |\n");
+ ibase_blob_add($bl_h, "| |\n");
+ ibase_blob_add($bl_h, "| This program is distributed in the hope that it will be useful, |\n");
+ ibase_blob_add($bl_h, "| but WITHOUT ANY WARRANTY; without even the implied warranty of |\n");
+ ibase_blob_add($bl_h, "| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |\n");
+ ibase_blob_add($bl_h, "| GNU General Public License for more details. |\n");
+ ibase_blob_add($bl_h, "| |\n");
+ ibase_blob_add($bl_h, "| You should have received a copy of both licenses referred to here. |\n");
+ ibase_blob_add($bl_h, "| If you did not, or have any questions about PHP licensing, please |\n");
+ ibase_blob_add($bl_h, "| contact core@php.net. |\n");
+ ibase_blob_add($bl_h, "+----------------------------------------------------------------------+\n");
+ $bl_s = ibase_blob_close($bl_h);
+ ibase_query("insert into test4 (v_integer, v_blob) values (3, ?)", $bl_s);
+
+ echo "echo blob 3\n";
+
+ $q = ibase_query("select v_blob from test4 where v_integer = 3");
+ $row = ibase_fetch_object($q);
+ ibase_blob_echo($row->V_BLOB);
+ ibase_free_result($q);
+
+ echo "fetch blob 3\n";
+ $q = ibase_query("select v_blob from test4 where v_integer = 3");
+ $row = ibase_fetch_object($q,IBASE_TEXT);
+ echo $row->V_BLOB;
+ ibase_free_result($q);
+
+ ibase_close();
+ unlink($name);
+ echo "end of test\n";
+?>
+--EXPECT--
+import blob 1
+test blob 1
+create blob 2
+test blob 2
+create blob 3
+echo blob 3
++----------------------------------------------------------------------+
+| PHP HTML Embedded Scripting Language Version 3.0 |
++----------------------------------------------------------------------+
+| Copyright (c) 1997-2000 PHP Development Team (See Credits file) |
++----------------------------------------------------------------------+
+| This program is free software; you can redistribute it and/or modify |
+| it under the terms of one of the following licenses: |
+| |
+| A) the GNU General Public License as published by the Free Software |
+| Foundation; either version 2 of the License, or (at your option) |
+| any later version. |
+| |
+| B) the PHP License as published by the PHP Development Team and |
+| included in the distribution in the file: LICENSE |
+| |
+| This program is distributed in the hope that it will be useful, |
+| but WITHOUT ANY WARRANTY; without even the implied warranty of |
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+| GNU General Public License for more details. |
+| |
+| You should have received a copy of both licenses referred to here. |
+| If you did not, or have any questions about PHP licensing, please |
+| contact core@php.net. |
++----------------------------------------------------------------------+
+fetch blob 3
++----------------------------------------------------------------------+
+| PHP HTML Embedded Scripting Language Version 3.0 |
++----------------------------------------------------------------------+
+| Copyright (c) 1997-2000 PHP Development Team (See Credits file) |
++----------------------------------------------------------------------+
+| This program is free software; you can redistribute it and/or modify |
+| it under the terms of one of the following licenses: |
+| |
+| A) the GNU General Public License as published by the Free Software |
+| Foundation; either version 2 of the License, or (at your option) |
+| any later version. |
+| |
+| B) the PHP License as published by the PHP Development Team and |
+| included in the distribution in the file: LICENSE |
+| |
+| This program is distributed in the hope that it will be useful, |
+| but WITHOUT ANY WARRANTY; without even the implied warranty of |
+| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
+| GNU General Public License for more details. |
+| |
+| You should have received a copy of both licenses referred to here. |
+| If you did not, or have any questions about PHP licensing, please |
+| contact core@php.net. |
++----------------------------------------------------------------------+
+end of test
diff --git a/ext/interbase/tests/005.phpt b/ext/interbase/tests/005.phpt
new file mode 100644
index 0000000000..5cf77667e0
--- /dev/null
+++ b/ext/interbase/tests/005.phpt
@@ -0,0 +1,275 @@
+--TEST--
+InterBase: transactions
+--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);
+
+ @ibase_query("create table test5 (i integer)");
+ @ibase_query("delete from test5");
+ ibase_close();
+
+
+ echo "default transaction:\n";
+
+/*
+Difference between default and other transactions:
+default commited when you call ibase_close().
+Other transaction doing rollback.
+
+If you not open default transaction with
+ibase_trans, default transaction open
+when you call ibase_query(), ibase_prepare(),
+ibase_blob_create(), ibase_blob_import() first time.
+*/
+
+/*
+simple default transaction test without ibase_trans()
+*/
+
+ ibase_connect($test_base);
+
+ echo "empty table\n";
+
+ /* out_table call ibase_query()
+ and ibase_query() start default transaction */
+ out_table("test5");
+
+ /* in default transaction context */
+ ibase_query("insert into test5 (i) values (1)");
+
+ echo "one row\n";
+ out_table("test5");
+
+ ibase_rollback(); /* default rolled */
+
+ echo "after rollback table empty again\n";
+ out_table("test5"); /* started new default transaction */
+
+ ibase_query("insert into test5 (i) values (2)");
+
+ ibase_close(); /* commit here! */
+
+ ibase_connect($test_base);
+
+ echo "one row\n";
+ out_table("test5");
+ ibase_close();
+
+/*
+default transaction on default link
+First open transaction on link will be default.
+$tr_def_l1 may be ommited. All queryes without link and trans
+parameters run in this context
+*/
+
+ $link_def = ibase_connect($test_base);
+
+ $tr_def_l1 = ibase_trans(IBASE_READ); /* here transaction start */
+
+ /* all default */
+ $res = ibase_query("select * from test5");
+
+ echo "one row\n";
+ out_result($res,"test5");
+
+ ibase_free_result($res);
+
+ /* specify transaction context... */
+ $res = ibase_query($tr_def_l1, "select * from test5");
+
+ echo "one row... again.\n";
+ out_result($res,"test5");
+
+ ibase_free_result($res);
+
+ /* specify default transaction on link */
+ $res = ibase_query($link_def, "select * from test5");
+
+ echo "one row.\n";
+ out_result($res,"test5");
+
+ ibase_free_result($res);
+
+ ibase_rollback($link_def); /* just for example */
+
+ ibase_close();
+
+/*
+three transaction on default link
+*/
+ ibase_connect($test_base);
+
+ $tr_1 = ibase_trans(); /* this default transaction also */
+ $tr_2 = ibase_trans(IBASE_READ);
+ $tr_3 = ibase_trans(IBASE_READ+IBASE_COMMITED);
+
+ $res = ibase_query("select * from test5");
+
+ echo "one row\n";
+ out_result($res,"test5");
+
+ ibase_free_result($res);
+
+ /* insert in first transaction context... */
+ /* as default */
+ ibase_query("insert into test5 (i) values (3)");
+ /* specify context */
+ ibase_query($tr_1, "insert into test5 (i) values (4)");
+
+ $res = ibase_query("select * from test5");
+
+ echo "three rows\n";
+ out_result($res,"test5");
+
+ ibase_free_result($res);
+
+ $res = ibase_query($tr_1, "select * from test5");
+
+ echo "three rows again\n";
+ out_result($res,"test5");
+
+ ibase_free_result($res);
+
+ ibase_commit($tr_1);
+
+ $res = ibase_query($tr_2, "select * from test5");
+
+ echo "one row in second transaction\n";
+ out_result($res,"test5");
+
+ ibase_free_result($res);
+
+ $res = ibase_query($tr_3, "select * from test5");
+
+ echo "three rows in third transaction\n";
+ out_result($res,"test5");
+
+ ibase_free_result($res);
+
+ ibase_close();
+
+/*
+transactions on second link
+*/
+ $link_1 = ibase_pconnect($test_base);
+ $link_2 = ibase_pconnect($test_base);
+
+ $tr_1 = ibase_trans($link_2, IBASE_DEFAULT); /* this default transaction also */
+ $tr_2 = ibase_trans($link_2, IBASE_COMMITED);
+
+ $res = ibase_query($tr_1, "select * from test5");
+
+ echo "three rows\n";
+ out_result($res,"test5");
+
+ ibase_free_result($res);
+
+ ibase_query($tr_1, "insert into test5 (i) values (5)");
+
+ $res = ibase_query($tr_1, "select * from test5");
+
+ echo "four rows\n";
+ out_result($res,"test5");
+
+ ibase_free_result($res);
+
+ ibase_commit($tr_1);
+
+ $res = ibase_query($tr_2, "select * from test5");
+
+ echo "four rows again\n";
+ out_result($res,"test5");
+
+ ibase_free_result($res);
+
+ ibase_close($link_1);
+ ibase_close($link_2);
+
+ echo "end of test\n";
+?>
+--EXPECT--
+default transaction:
+empty table
+--- test5 ---
+---
+one row
+--- test5 ---
+1
+---
+after rollback table empty again
+--- test5 ---
+---
+one row
+--- test5 ---
+2
+---
+one row
+--- test5 ---
+2
+---
+one row... again.
+--- test5 ---
+2
+---
+one row.
+--- test5 ---
+2
+---
+one row
+--- test5 ---
+2
+---
+three rows
+--- test5 ---
+2
+3
+4
+---
+three rows again
+--- test5 ---
+2
+3
+4
+---
+one row in second transaction
+--- test5 ---
+2
+---
+three rows in third transaction
+--- test5 ---
+2
+3
+4
+---
+three rows
+--- test5 ---
+2
+3
+4
+---
+four rows
+--- test5 ---
+2
+3
+4
+5
+---
+four rows again
+--- test5 ---
+2
+3
+4
+5
+---
+end of test
+
diff --git a/ext/interbase/tests/006.phpt b/ext/interbase/tests/006.phpt
new file mode 100644
index 0000000000..bad07e3315
--- /dev/null
+++ b/ext/interbase/tests/006.phpt
@@ -0,0 +1,227 @@
+--TEST--
+InterBase: binding (may take a while)
+--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);
+
+ ibase_query(
+ "create table test6 (
+ iter integer,
+ v_char char(1000),
+ v_date date,
+ v_decimal decimal(12,3),
+ v_double double precision,
+ v_float float,
+ v_integer integer,
+ v_numeric numeric(4,2),
+ v_smallint smallint,
+ v_varchar varchar(10000)
+ )");
+ ibase_commit();
+
+ /* if timefmt not supported, hide error */
+ @ibase_timefmt("%m/%d/%Y %H:%M:%S");
+
+ echo "insert\n";
+
+ for($iter = 0; $iter < 3; $iter++){
+ /* prepare data */
+ $v_char = rand_str(1000);
+ $v_date = rand_datetime();
+ $v_decimal = rand_number(12,3);
+ $v_double = rand_number(20);
+ $v_float = rand_number(7);
+ $v_integer = rand_number(9,0);
+ $v_numeric = rand_number(4,2);
+ $v_smallint = rand_number(5) % 32767;
+ $v_varchar = rand_str(10000);
+
+ ibase_query("insert into test6
+ (iter,v_char,v_date,v_decimal,v_double,v_float,
+ v_integer,v_numeric,v_smallint,v_varchar)
+ values (?,?,?,?,?,?,?,?,?,?)",
+ $iter, $v_char, $v_date, $v_decimal, $v_double, $v_float,
+ $v_integer, $v_numeric, $v_smallint, $v_varchar);
+ $sel = ibase_query("select * from test6 where iter = $iter");
+
+ $row = ibase_fetch_object($sel);
+ if(substr($row->V_CHAR,0,strlen($v_char)) != $v_char){
+ echo " CHAR fail:\n";
+ echo " in: $v_char\n";
+ echo " out: $row->V_CHAR\n";
+ }
+ if($row->V_DATE != $v_date){
+ echo " DATE fail\n";
+ echo " in: $v_date\n";
+ echo " out: $row->V_DATE\n";
+ }
+ if($row->V_DECIMAL != $v_decimal){
+ echo " DECIMAL fail\n";
+ echo " in: $v_decimal\n";
+ echo " out: $row->V_DECIMAL\n";
+ }
+ if(abs($row->V_DOUBLE - $v_double) > abs($v_double / 1E15)){
+ echo " DOUBLE fail\n";
+ echo " in: $v_double\n";
+ echo " out: $row->V_DOUBLE\n";
+ }
+ if(abs($row->V_FLOAT - $v_float) > abs($v_float / 1E7)){
+ echo " FLOAT fail\n";
+ echo " in: $v_float\n";
+ echo " out: $row->V_FLOAT\n";
+ }
+ if($row->V_INTEGER != $v_integer){
+ echo " INTEGER fail\n";
+ echo " in: $v_integer\n";
+ echo " out: $row->V_INTEGER\n";
+ }
+ ibase_free_result($sel);
+ }/* for($iter)*/
+
+ echo "select\n";
+ for($iter = 0; $iter < 3; $iter++){
+ /* prepare data */
+ $v_char = rand_str(1000);
+ $v_date = rand_datetime();
+ $v_decimal = rand_number(12,3);
+ $v_double = rand_number(20);
+ $v_float = rand_number(7);
+ $v_integer = rand_number(9,0);
+ $v_numeric = rand_number(4,2);
+ $v_smallint = rand_number(5) % 32767;
+ $v_varchar = rand_str(10000);
+
+ /* clear table*/
+ ibase_query("delete from test6");
+
+ /* make one record */
+ ibase_query("insert into test6
+ (iter, v_char,v_date,v_decimal,
+ v_integer,v_numeric,v_smallint,v_varchar)
+ values (666, '$v_char','$v_date',$v_decimal, $v_integer,
+ $v_numeric, $v_smallint, '$v_varchar')");
+
+ /* test all types */
+ if(!($sel = ibase_query(
+ "select iter from test6 where v_char = ?", $v_char)))
+ echo "CHAR fail\n";
+ ibase_free_result($sel);
+ if(!($sel = ibase_query(
+ "select iter from test6 where v_date = ?", $v_date)))
+ echo "DATE fail\n";
+ ibase_free_result($sel);
+ if(!($sel = ibase_query(
+ "select iter from test6 where v_decimal = ?", $v_decimal)))
+ echo "DECIMAL fail\n";
+ ibase_free_result($sel);
+ if(!($sel = ibase_query(
+ "select iter from test6 where v_integer = ?", $v_integer)))
+ echo "INTEGER fail\n";
+ ibase_free_result($sel);
+ if(!($sel = ibase_query(
+ "select iter from test6 where v_numeric = ?", $v_numeric)))
+ echo "NUMERIC fail\n";
+ ibase_free_result($sel);
+ if(!($sel = ibase_query(
+ "select iter from test6 where v_smallint = ?", $v_smallint)))
+ echo "SMALLINT fail\n";
+ ibase_free_result($sel);
+ if(!($sel = ibase_query(
+ "select iter from test6 where v_varchar = ?", $v_varchar)))
+ echo "VARCHAR fail\n";
+ ibase_free_result($sel);
+
+ }/*for iter*/
+
+ echo "prepare and exec insert\n";
+
+ /* prepare table */
+ ibase_query("delete from test6");
+
+ /* prepare query */
+ $query = ibase_prepare(
+ "insert into test6 (v_integer) values (?)");
+
+ for($i = 0; $i < 10; $i++)
+ ibase_execute($query, $i);
+
+ out_table("test6");
+
+ ibase_free_query($query);
+
+
+ echo "prepare and exec select\n";
+
+ /* prepare query */
+ $query = ibase_prepare("select * from test6
+ where v_integer between ? and ?");
+
+ $low_border = 2;
+ $high_border = 6;
+
+ $res = ibase_execute($query, $low_border, $high_border);
+ out_result($res, "test6");
+ ibase_free_result($res);
+
+ $low_border = 0;
+ $high_border = 4;
+ $res = ibase_execute($query, $low_border, $high_border);
+ out_result($res, "test6");
+ ibase_free_result($res);
+
+ $res = ibase_execute($query, "5", 7.5);
+ out_result($res, "test6");
+ ibase_free_result($res);
+
+ ibase_free_query($query);
+ ibase_close();
+ echo "end of test\n";
+?>
+--EXPECT--
+insert
+select
+prepare and exec insert
+--- test6 ---
+ 0
+ 1
+ 2
+ 3
+ 4
+ 5
+ 6
+ 7
+ 8
+ 9
+---
+prepare and exec select
+--- test6 ---
+ 2
+ 3
+ 4
+ 5
+ 6
+---
+--- test6 ---
+ 0
+ 1
+ 2
+ 3
+ 4
+---
+--- test6 ---
+ 5
+ 6
+ 7
+---
+end of test
+
diff --git a/ext/interbase/tests/extension b/ext/interbase/tests/extension
new file mode 100755
index 0000000000..3b561c46a9
--- /dev/null
+++ b/ext/interbase/tests/extension
@@ -0,0 +1 @@
+InterBase
diff --git a/ext/interbase/tests/interbase.inc b/ext/interbase/tests/interbase.inc
new file mode 100755
index 0000000000..f261cb01b5
--- /dev/null
+++ b/ext/interbase/tests/interbase.inc
@@ -0,0 +1,77 @@
+<?
+/* $Id$ */
+/* used in tests */
+
+srand((double)microtime()*1000000);
+
+function out_table($table_name)
+{
+ echo "--- $table_name ---\n";
+ $res = ibase_query("select * from $table_name");
+ $f = ibase_num_fields($res);
+ while ($r = ibase_fetch_row($res)){
+ for($i = 0; $i < $f; $i++)
+ echo "$r[$i]\t";
+ echo "\n";
+ }
+ ibase_free_result($res);
+ echo "---\n";
+}
+
+function out_result($result, $table_name = "")
+{
+ echo "--- $table_name ---\n";
+ $f = ibase_num_fields($result);
+ while ($r = ibase_fetch_row($result)){
+ for($i = 0; $i < $f; $i++)
+ echo "$r[$i]\t";
+ echo "\n";
+ }
+ echo "---\n";
+}
+
+/* M/D/Y H:M:S */
+function rand_datetime()
+{
+ return sprintf("%02d/%02d/%4d %02d:%02d:%02d",
+ rand()%12+1, rand()%28+1, rand()%100+1910,
+ rand()%24, rand()%60, rand()%60);
+}
+
+/* random binary string */
+function rand_binstr($max_len)
+{
+ $len = rand() % $max_len;
+ $s = "";
+ while($len--)
+ $s .= sprintf("%c", rand() % 256);
+ return $s;
+}
+
+function rand_str($max_len)
+{
+ $len = rand() % $max_len;
+ $s = "";
+ while($len--)
+ $s .= sprintf("%c", rand() % 26 + 65);;
+ return $s;
+}
+
+function rand_number($len , $prec = -1, $sign = 1)
+{
+ if($prec == -1){
+ $n = substr(rand() . rand(), 0, rand() % $len + 1);
+ if(strlen($n) < $len)
+ $n .= "." . substr(rand(), 0, rand() % ($len - strlen($n)) + 1);
+ }elseif ($prec == 0){
+ $n = substr(rand() . rand(), 0, rand() % $len + 1);
+ }else{
+ $n = substr(rand() . rand(), 0, rand() % ($len - $prec) + 1);
+ $n .= "." . substr(rand(), 0, $prec);
+ }
+ if($sign && (rand() % 3 == 0))
+ $n = "-" .$n;
+ return $n;
+}
+
+?> \ No newline at end of file
diff --git a/ext/standard/tests/file/001.phpt b/ext/standard/tests/file/001.phpt
new file mode 100644
index 0000000000..b95a1e6d65
--- /dev/null
+++ b/ext/standard/tests/file/001.phpt
@@ -0,0 +1,141 @@
+--TEST--
+File type functions
+--POST--
+--GET--
+--FILE--
+<?php
+@unlink('test.file');
+@unlink('test.link');
+if (file_exists('test.file')) {
+ echo "test.file exists\n";
+} else {
+ echo "test.file does not exist\n";
+}
+fclose (fopen('test.file', 'w'));
+chmod ('test.file', 0654);
+if (file_exists('test.file')) {
+ echo "test.file exists\n";
+} else {
+ echo "test.file does not exist\n";
+}
+sleep (2);
+symlink('test.file','test.link');
+if (file_exists('test.link')) {
+ echo "test.link exists\n";
+} else {
+ echo "test.link does not exist\n";
+}
+if (is_link('test.file')) {
+ echo "test.file is a symlink\n";
+} else {
+ echo "test.file is not a symlink\n";
+}
+if (is_link('test.link')) {
+ echo "test.link is a symlink\n";
+} else {
+ echo "test.link is not a symlink\n";
+}
+if (file_exists('test.file')) {
+ echo "test.file exists\n";
+} else {
+ echo "test.file does not exist\n";
+}
+$s = stat ('test.file');
+$ls = lstat ('test.file');
+for ($i = 0; $i <= 12; $i++) {
+ if ($ls[$i] != $s[$i]) {
+ echo "test.file lstat and stat differ at element $i\n";
+ }
+}
+$s = stat ('test.link');
+$ls = lstat ('test.link');
+for ($i = 0; $i <= 11; $i++) {
+ if ($ls[$i] != $s[$i]) {
+ if($i!=6) echo "test.link lstat and stat differ at element $i\n";
+ }
+}
+echo "test.file is " . filetype('test.file') . "\n";
+echo "test.link is " . filetype('test.link') . "\n";
+printf ("test.file permissions are 0%o\n", 0777 & fileperms('test.file'));
+echo "test.file size is " . filesize('test.file') . "\n";
+if (is_writeable('test.file')) {
+ echo "test.file is writeable\n";
+} else {
+ echo "test.file is not writeable\n";
+}
+if (is_readable('test.file')) {
+ echo "test.file is readable\n";
+} else {
+ echo "test.file is not readable\n";
+}
+if (is_executable('test.file')) {
+ echo "test.file is executable\n";
+} else {
+ echo "test.file is not executable\n";
+}
+if (is_file('test.file')) {
+ echo "test.file is a regular file\n";
+} else {
+ echo "test.file is not a regular file\n";
+}
+if (is_file('test.link')) {
+ echo "test.link is a regular file\n";
+} else {
+ echo "test.link is not a regular file\n";
+}
+if (is_dir('test.link')) {
+ echo "test.link is a directory\n";
+} else {
+ echo "test.link is not a directory\n";
+}
+if (is_dir('file')) {
+ echo "file is a directory\n";
+} else {
+ echo "file is not a directory\n";
+}
+if (is_dir('test.file')) {
+ echo "test.file is a directory\n";
+} else {
+ echo "test.file is not a directory\n";
+}
+unlink('test.file');
+unlink('test.link');
+if (file_exists('test.file')) {
+ echo "test.file exists (cached)\n";
+} else {
+ echo "test.file does not exist\n";
+}
+clearstatcache();
+if (file_exists('test.file')) {
+ echo "test.file exists\n";
+} else {
+ echo "test.file does not exist\n";
+}
+?>
+--EXPECT--
+test.file does not exist
+test.file exists
+test.link exists
+test.file is not a symlink
+test.link is a symlink
+test.file exists
+test.link lstat and stat differ at element 1
+test.link lstat and stat differ at element 2
+test.link lstat and stat differ at element 7
+test.link lstat and stat differ at element 8
+test.link lstat and stat differ at element 9
+test.link lstat and stat differ at element 10
+test.file is file
+test.link is link
+test.file permissions are 0654
+test.file size is 0
+test.file is writeable
+test.file is readable
+test.file is not executable
+test.file is a regular file
+test.link is a regular file
+test.link is not a directory
+file is a directory
+test.file is not a directory
+test.file does not exist
+test.file does not exist
diff --git a/ext/standard/tests/general_functions/001.phpt b/ext/standard/tests/general_functions/001.phpt
new file mode 100644
index 0000000000..ee6d32f7f8
--- /dev/null
+++ b/ext/standard/tests/general_functions/001.phpt
@@ -0,0 +1,55 @@
+--TEST--
+sprintf() function
+--POST--
+--GET--
+--FILE--
+<?php
+
+$agent = sprintf("%.5s", "James Bond, 007");
+
+echo("sprintf string truncate test: ");
+if ($agent == "James") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo("sprintf padding and align test: ");
+$test = sprintf("abc%04d %-20s%c", 20, "fisketur", 33);
+if ($test == "abc0020 fisketur !") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo("sprintf octal and hex test: ");
+$test = sprintf("%4o %4x %4X %0"."8x", 128, 1024, 49151, 3457925);
+if ($test == " 200 400 BFFF 0034c385") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo("sprintf octal binary test: ");
+$test = sprintf("%b", 3457925);
+if ($test == "1101001100001110000101") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+echo("sprintf float test: ");
+$test = sprintf("%0"."06.2f", 10000/3.0);
+if ($test == "003333.33") {
+ echo("passed\n");
+} else {
+ echo("failed!\n");
+}
+
+?>
+--EXPECT--
+sprintf string truncate test: passed
+sprintf padding and align test: passed
+sprintf octal and hex test: passed
+sprintf octal binary test: passed
+sprintf float test: passed
diff --git a/ext/standard/tests/math/001.phpt b/ext/standard/tests/math/001.phpt
new file mode 100644
index 0000000000..dee4217342
--- /dev/null
+++ b/ext/standard/tests/math/001.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Simple math tests
+--POST--
+--GET--
+--FILE--
+<?php
+ echo abs(-1) . "\n";
+ echo abs(-1.5) . "\n";
+ echo abs("-1") . "\n";
+ echo abs("-1.5") . "\n";
+ echo ceil(-1.5) . "\n";
+ echo ceil(1.5) . "\n";
+ echo floor(-1.5) . "\n";
+ echo floor(1.5) . "\n";
+?>
+--EXPECT--
+
+1
+1.5
+1
+1.5
+-1
+2
+-2
+1
diff --git a/ext/standard/tests/reg/001.phpt b/ext/standard/tests/reg/001.phpt
new file mode 100644
index 0000000000..f63c252518
--- /dev/null
+++ b/ext/standard/tests/reg/001.phpt
@@ -0,0 +1,9 @@
+--TEST--
+RegReplace test 1
+--POST--
+--GET--
+--FILE--
+<?php $a="abc123";
+ echo ereg_replace("123","def",$a)?>
+--EXPECT--
+abcdef
diff --git a/ext/standard/tests/reg/002.phpt b/ext/standard/tests/reg/002.phpt
new file mode 100644
index 0000000000..a9b7aaa00a
--- /dev/null
+++ b/ext/standard/tests/reg/002.phpt
@@ -0,0 +1,9 @@
+--TEST--
+RegReplace test 2
+--POST--
+--GET--
+--FILE--
+<?php $a="abc123";
+ echo ereg_replace("123","",$a)?>
+--EXPECT--
+abc
diff --git a/ext/standard/tests/reg/003.phpt b/ext/standard/tests/reg/003.phpt
new file mode 100644
index 0000000000..bb42729ca2
--- /dev/null
+++ b/ext/standard/tests/reg/003.phpt
@@ -0,0 +1,11 @@
+--TEST--
+ereg_replace single-quote test
+--POST--
+--GET--
+--FILE--
+<?php $a="\\'test";
+ echo ereg_replace("\\\\'","'",$a)
+?>
+--EXPECT--
+
+'test
diff --git a/ext/standard/tests/reg/004.phpt b/ext/standard/tests/reg/004.phpt
new file mode 100644
index 0000000000..1f60ff4900
--- /dev/null
+++ b/ext/standard/tests/reg/004.phpt
@@ -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
diff --git a/ext/standard/tests/reg/005.phpt b/ext/standard/tests/reg/005.phpt
new file mode 100644
index 0000000000..78c0a0912a
--- /dev/null
+++ b/ext/standard/tests/reg/005.phpt
@@ -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
diff --git a/ext/standard/tests/reg/006.phpt b/ext/standard/tests/reg/006.phpt
new file mode 100644
index 0000000000..50b6dbfd3a
--- /dev/null
+++ b/ext/standard/tests/reg/006.phpt
@@ -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
diff --git a/ext/standard/tests/reg/007.phpt b/ext/standard/tests/reg/007.phpt
new file mode 100644
index 0000000000..2223d48e22
--- /dev/null
+++ b/ext/standard/tests/reg/007.phpt
@@ -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
diff --git a/ext/standard/tests/reg/008.phpt b/ext/standard/tests/reg/008.phpt
new file mode 100644
index 0000000000..db61d1ca07
--- /dev/null
+++ b/ext/standard/tests/reg/008.phpt
@@ -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 +-|=
diff --git a/ext/standard/tests/reg/009.phpt b/ext/standard/tests/reg/009.phpt
new file mode 100644
index 0000000000..4996ef4c97
--- /dev/null
+++ b/ext/standard/tests/reg/009.phpt
@@ -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
diff --git a/ext/standard/tests/reg/010.phpt b/ext/standard/tests/reg/010.phpt
new file mode 100644
index 0000000000..30d28fd02f
--- /dev/null
+++ b/ext/standard/tests/reg/010.phpt
@@ -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
diff --git a/ext/standard/tests/reg/011.phpt b/ext/standard/tests/reg/011.phpt
new file mode 100644
index 0000000000..4eda774f58
--- /dev/null
+++ b/ext/standard/tests/reg/011.phpt
@@ -0,0 +1,9 @@
+--TEST--
+\0 back reference
+--POST--
+--GET--
+--FILE--
+<?php $a="abc123";
+ echo ereg_replace("123","def\\0ghi",$a)?>
+--EXPECT--
+abcdef123ghi
diff --git a/ext/standard/tests/reg/012.phpt b/ext/standard/tests/reg/012.phpt
new file mode 100644
index 0000000000..d5342c7436
--- /dev/null
+++ b/ext/standard/tests/reg/012.phpt
@@ -0,0 +1,9 @@
+--TEST--
+nonexisting back reference
+--POST--
+--GET--
+--FILE--
+<?php $a="abc123";
+ echo ereg_replace("123",'def\1ghi',$a)?>
+--EXPECT--
+abcdef\1ghi
diff --git a/ext/standard/tests/reg/013.phpt b/ext/standard/tests/reg/013.phpt
new file mode 100644
index 0000000000..ec3329fa7c
--- /dev/null
+++ b/ext/standard/tests/reg/013.phpt
@@ -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\
diff --git a/ext/standard/tests/reg/014.phpt b/ext/standard/tests/reg/014.phpt
new file mode 100644
index 0000000000..ec4d19ed0e
--- /dev/null
+++ b/ext/standard/tests/reg/014.phpt
@@ -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
diff --git a/ext/standard/tests/reg/015.phpt b/ext/standard/tests/reg/015.phpt
new file mode 100644
index 0000000000..961a60fa76
--- /dev/null
+++ b/ext/standard/tests/reg/015.phpt
@@ -0,0 +1,8 @@
+--TEST--
+replace empty matches
+--POST--
+--GET--
+--FILE--
+<?php echo ereg_replace("^","z","abc123")?>
+--EXPECT--
+zabc123
diff --git a/ext/standard/tests/reg/016.phpt b/ext/standard/tests/reg/016.phpt
new file mode 100644
index 0000000000..a24816f182
--- /dev/null
+++ b/ext/standard/tests/reg/016.phpt
@@ -0,0 +1,8 @@
+--TEST--
+test backslash handling in regular expressions
+--POST--
+--GET--
+--FILE--
+<?php echo ereg_replace('\?',"abc","?123?")?>
+--EXPECT--
+abc123abc