summaryrefslogtreecommitdiff
path: root/sapi/tests
diff options
context:
space:
mode:
authorShane Caraveo <shane@php.net>2003-03-25 07:45:18 +0000
committerShane Caraveo <shane@php.net>2003-03-25 07:45:18 +0000
commitb671380b6b5b6e1f4f235e810afa4199e989d2ba (patch)
tree12be51ce151c304b94a4c3c9444b151a6e398090 /sapi/tests
parent56210b8921dcd48959d904f030d320db7d28f7fa (diff)
downloadphp-git-b671380b6b5b6e1f4f235e810afa4199e989d2ba.tar.gz
many new enhancements to run-tests that allow for testing cgi and other
sapi modules via http. see README.TESTING2 for more details several sapi tests added
Diffstat (limited to 'sapi/tests')
-rw-r--r--sapi/tests/test001.phpt17
-rw-r--r--sapi/tests/test002.phpt23
-rw-r--r--sapi/tests/test003.phpt22
-rw-r--r--sapi/tests/test004.phpt27
-rw-r--r--sapi/tests/test005.phpt28
-rw-r--r--sapi/tests/test006.phpt75
-rw-r--r--sapi/tests/test007.phpt48
7 files changed, 240 insertions, 0 deletions
diff --git a/sapi/tests/test001.phpt b/sapi/tests/test001.phpt
new file mode 100644
index 0000000000..2c5d808e66
--- /dev/null
+++ b/sapi/tests/test001.phpt
@@ -0,0 +1,17 @@
+--TEST--
+IIS style CGI missing SCRIPT_FILENAME
+--DESCRIPTION--
+This would be similar to what IIS produces for a simple query.
+--ENV--
+return <<<END
+PATH_TRANSLATED=$filename
+PATH_INFO=$scriptname
+SCRIPT_NAME=$scriptname
+END;
+--CGI--
+--FILE--
+<?php
+ echo "HELLO";
+?>
+--EXPECT--
+HELLO \ No newline at end of file
diff --git a/sapi/tests/test002.phpt b/sapi/tests/test002.phpt
new file mode 100644
index 0000000000..e0c51b60e3
--- /dev/null
+++ b/sapi/tests/test002.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Apache style CGI
+--DESCRIPTION--
+Apache likes to set SCRIPT_FILENAME to the php executable
+if you use ScriptAlias configurations, and the proper
+path is in PATH_TRANSLATED. SCRIPT_NAME in this is faked,
+but that is ok, Apache sets SCRIPT_NAME to the ScriptAlias
+of the executable.
+--ENV--
+return <<<END
+REDIRECT_URL=$scriptname
+PATH_TRANSLATED=$filename
+PATH_INFO=$scriptname
+SCRIPT_NAME=/scriptalias/php
+SCRIPT_FILENAME=$this->conf['TEST_PHP_EXECUTABLE']
+END;
+--CGI--
+--FILE--
+<?php
+ echo "HELLO";
+?>
+--EXPECT--
+HELLO \ No newline at end of file
diff --git a/sapi/tests/test003.phpt b/sapi/tests/test003.phpt
new file mode 100644
index 0000000000..f0a31ab705
--- /dev/null
+++ b/sapi/tests/test003.phpt
@@ -0,0 +1,22 @@
+--TEST--
+IIS style CGI missing SCRIPT_FILENAME, has PATH_INFO
+--DESCRIPTION--
+This would be similar to what IIS produces for a simple query
+that also has PATH_INFO.
+--REQUEST--
+return <<<END
+PATH_INFO=/path/info
+END;
+--ENV--
+return <<<END
+PATH_TRANSLATED=$filename/path/info
+PATH_INFO=$scriptname/path/info
+SCRIPT_NAME=$scriptname
+END;
+--CGI--
+--FILE--
+<?php
+ echo $_SERVER['PATH_INFO'];
+?>
+--EXPECT--
+/path/info \ No newline at end of file
diff --git a/sapi/tests/test004.phpt b/sapi/tests/test004.phpt
new file mode 100644
index 0000000000..03e73d3219
--- /dev/null
+++ b/sapi/tests/test004.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Apache style CGI with PATH_INFO
+--DESCRIPTION--
+Apache likes to set SCRIPT_FILENAME to the php executable
+if you use ScriptAlias configurations, and the proper
+path is in PATH_TRANSLATED. SCRIPT_NAME in this is faked,
+but that is ok, Apache sets SCRIPT_NAME to the ScriptAlias
+of the executable.
+--REQUEST--
+return <<<END
+PATH_INFO=/path/info
+END;
+--ENV--
+return <<<END
+REDIRECT_URL=$scriptname
+PATH_TRANSLATED=$filename/path/info
+PATH_INFO=$scriptname/path/info
+SCRIPT_NAME=/scriptalias/php
+SCRIPT_FILENAME=$this->conf['TEST_PHP_EXECUTABLE']
+END;
+--CGI--
+--FILE--
+<?php
+ echo $_SERVER['PATH_INFO'];
+?>
+--EXPECT--
+/path/info \ No newline at end of file
diff --git a/sapi/tests/test005.phpt b/sapi/tests/test005.phpt
new file mode 100644
index 0000000000..ab500eb422
--- /dev/null
+++ b/sapi/tests/test005.phpt
@@ -0,0 +1,28 @@
+--TEST--
+QUERY_STRING Security Bug
+--DESCRIPTION--
+This bug was present in PHP 4.3.0 only.
+A failure should print HELLO.
+--REQUEST--
+return <<<END
+SCRIPT_NAME=/nothing.php
+QUERY_STRING=$filename
+END;
+--ENV--
+return <<<END
+REDIRECT_URL=$scriptname
+PATH_TRANSLATED=c:\apache\1.3.27\htdocs\nothing.php
+QUERY_STRING=$filename
+PATH_INFO=/nothing.php
+SCRIPT_NAME=/phpexe/php.exe/nothing.php
+SCRIPT_FILENAME=c:\apache\1.3.27\htdocs\nothing.php
+END;
+--CGI--
+--FILE--
+<?php
+ echo "HELLO";
+?>
+--EXPECTHEADERS--
+Status: 404
+--EXPECT--
+No input file specified. \ No newline at end of file
diff --git a/sapi/tests/test006.phpt b/sapi/tests/test006.phpt
new file mode 100644
index 0000000000..b674a9f78f
--- /dev/null
+++ b/sapi/tests/test006.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Multipart Form POST Data
+--CGI--
+--HEADERS--
+return <<<END
+Content-Type=multipart/form-data; boundary=---------------------------240723202011929
+Content-Length=862
+END;
+--ENV--
+return <<<END
+CONTENT_TYPE=multipart/form-data; boundary=---------------------------240723202011929
+CONTENT_LENGTH=862
+END;
+--POST--
+-----------------------------240723202011929
+Content-Disposition: form-data; name="entry"
+
+entry box
+-----------------------------240723202011929
+Content-Disposition: form-data; name="password"
+
+password box
+-----------------------------240723202011929
+Content-Disposition: form-data; name="radio1"
+
+test 1
+-----------------------------240723202011929
+Content-Disposition: form-data; name="checkbox1"
+
+test 1
+-----------------------------240723202011929
+Content-Disposition: form-data; name="choices"
+
+Choice 1
+-----------------------------240723202011929
+Content-Disposition: form-data; name="choices"
+
+Choice 2
+-----------------------------240723202011929
+Content-Disposition: form-data; name="file"; filename="info.php"
+Content-Type: application/octet-stream
+
+<?php
+phpinfo();
+?>
+-----------------------------240723202011929--
+
+--GET--
+--FILE--
+<?php
+error_reporting(0);
+print_r($_POST);
+print_r($_FILES);
+?>
+--EXPECTF--
+Array
+(
+ [entry] => entry box
+ [password] => password box
+ [radio1] => test 1
+ [checkbox1] => test 1
+ [choices] => Choice 2
+)
+Array
+(
+ [file] => Array
+ (
+ [name] => info.php
+ [type] => application/octet-stream
+ [tmp_name] => %s
+ [error] => 0
+ [size] => 21
+ )
+
+)
diff --git a/sapi/tests/test007.phpt b/sapi/tests/test007.phpt
new file mode 100644
index 0000000000..b79dfd9fe6
--- /dev/null
+++ b/sapi/tests/test007.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Multipart Form POST Data, incorrect content length
+--CGI--
+--HEADERS--
+return <<<END
+Content-Type=multipart/form-data; boundary=---------------------------240723202011929
+Content-Length=100
+END;
+--POST--
+-----------------------------240723202011929
+Content-Disposition: form-data; name="entry"
+
+entry box
+-----------------------------240723202011929
+Content-Disposition: form-data; name="password"
+
+password box
+-----------------------------240723202011929
+Content-Disposition: form-data; name="radio1"
+
+test 1
+-----------------------------240723202011929
+Content-Disposition: form-data; name="checkbox1"
+
+test 1
+-----------------------------240723202011929
+Content-Disposition: form-data; name="choices"
+
+Choice 1
+-----------------------------240723202011929
+Content-Disposition: form-data; name="choices"
+
+Choice 2
+-----------------------------240723202011929
+Content-Disposition: form-data; name="file"; filename="info.php"
+Content-Type: application/octet-stream
+
+<?php
+phpinfo();
+?>
+-----------------------------240723202011929--
+
+--GET--
+--FILE--
+<?php
+print @$_POST['choices'];
+?>
+--EXPECT--