summaryrefslogtreecommitdiffhomepage
path: root/test/php
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2018-05-22 20:20:14 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2018-05-22 20:20:14 +0300
commit3b7238996ad68f3c56a031e72e0b2f9aa0c8662c (patch)
treeb491b30834997e406d6139aaf39d7bc6140d7f30 /test/php
parent7d224bfc9e39cb7885885bb554ca21ab26f5ddd0 (diff)
downloadunit-3b7238996ad68f3c56a031e72e0b2f9aa0c8662c.tar.gz
unit-3b7238996ad68f3c56a031e72e0b2f9aa0c8662c.tar.bz2
Tests: initial PHP application tests.
Diffstat (limited to 'test/php')
-rw-r--r--test/php/404/404.html6
-rw-r--r--test/php/404/index.php4
-rw-r--r--test/php/conditional/index.php5
-rw-r--r--test/php/cookies/index.php4
-rw-r--r--test/php/get_variables/index.php7
-rw-r--r--test/php/mirror/index.php5
-rw-r--r--test/php/phpinfo/index.php3
-rw-r--r--test/php/post_variables/index.php6
-rw-r--r--test/php/variables/index.php13
9 files changed, 53 insertions, 0 deletions
diff --git a/test/php/404/404.html b/test/php/404/404.html
new file mode 100644
index 00000000..6d0c635a
--- /dev/null
+++ b/test/php/404/404.html
@@ -0,0 +1,6 @@
+<html>
+<head><title>404 Not Found</title></head>
+<body bgcolor="white">
+<center><h1>404 Not Found</h1></center>
+</body>
+</html>
diff --git a/test/php/404/index.php b/test/php/404/index.php
new file mode 100644
index 00000000..92afdf19
--- /dev/null
+++ b/test/php/404/index.php
@@ -0,0 +1,4 @@
+<?php
+http_response_code(404);
+include('404.html');
+?>
diff --git a/test/php/conditional/index.php b/test/php/conditional/index.php
new file mode 100644
index 00000000..421e1a2d
--- /dev/null
+++ b/test/php/conditional/index.php
@@ -0,0 +1,5 @@
+<?php if ($_SERVER['REQUEST_METHOD'] === 'GET'): ?>
+True
+<?php else: ?>
+False
+<?php endif; ?>
diff --git a/test/php/cookies/index.php b/test/php/cookies/index.php
new file mode 100644
index 00000000..72a3f092
--- /dev/null
+++ b/test/php/cookies/index.php
@@ -0,0 +1,4 @@
+<?php
+header('X-Cookie-1: ' . $_COOKIE['var']);
+header('X-Cookie-2: ' . $_COOKIE['var2']);
+?>
diff --git a/test/php/get_variables/index.php b/test/php/get_variables/index.php
new file mode 100644
index 00000000..dd7ef985
--- /dev/null
+++ b/test/php/get_variables/index.php
@@ -0,0 +1,7 @@
+<?php
+header('Content-Length: 0');
+header('X-Var-1: ' . $_GET['var1']);
+header('X-Var-2: ' . $_GET['var2'] . isset($_GET['var2']));
+header('X-Var-3: ' . $_GET['var3'] . isset($_GET['var3']));
+header('X-Var-4: ' . $_GET['var4'] . isset($_GET['var4']));
+?>
diff --git a/test/php/mirror/index.php b/test/php/mirror/index.php
new file mode 100644
index 00000000..ffd2291d
--- /dev/null
+++ b/test/php/mirror/index.php
@@ -0,0 +1,5 @@
+<?php
+$body = file_get_contents('php://input');
+header('Content-Length: ' . strlen($body));
+echo $body;
+?>
diff --git a/test/php/phpinfo/index.php b/test/php/phpinfo/index.php
new file mode 100644
index 00000000..cf608608
--- /dev/null
+++ b/test/php/phpinfo/index.php
@@ -0,0 +1,3 @@
+<?php
+phpinfo();
+?>
diff --git a/test/php/post_variables/index.php b/test/php/post_variables/index.php
new file mode 100644
index 00000000..5ea17324
--- /dev/null
+++ b/test/php/post_variables/index.php
@@ -0,0 +1,6 @@
+<?php
+header('Content-Length: 0');
+header('X-Var-1: ' . $_POST['var1']);
+header('X-Var-2: ' . $_POST['var2'] . isset($_POST['var2']));
+header('X-Var-3: ' . $_POST['var3'] . isset($_POST['var3']));
+?>
diff --git a/test/php/variables/index.php b/test/php/variables/index.php
new file mode 100644
index 00000000..8f2e3bfc
--- /dev/null
+++ b/test/php/variables/index.php
@@ -0,0 +1,13 @@
+<?php
+$body = file_get_contents('php://input');
+
+header('Content-Length: ' . strlen($body));
+header('Request-Method: ' . $_SERVER['REQUEST_METHOD']);
+header('Request-Uri: ' . $_SERVER['REQUEST_URI']);
+header('Http-Host: ' . $_SERVER['HTTP_HOST']);
+header('Server-Protocol: ' . $_SERVER['SERVER_PROTOCOL']);
+header('Server-Software: ' . $_SERVER['SERVER_SOFTWARE']);
+header('Custom-Header: ' . $_SERVER['HTTP_CUSTOM_HEADER']);
+
+echo $body;
+?>