summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorAndrey Zelenkov <zelenkov@nginx.com>2019-07-17 16:50:24 +0300
committerAndrey Zelenkov <zelenkov@nginx.com>2019-07-17 16:50:24 +0300
commit4153fad89dfeb694bf7f0c94d4c02da50af1852b (patch)
tree089da402a7e79e803c49fc926ec9be8732e50711 /test
parentdcf46a63eb43297180b5284fab0acca405a6a1c4 (diff)
downloadunit-4153fad89dfeb694bf7f0c94d4c02da50af1852b.tar.gz
unit-4153fad89dfeb694bf7f0c94d4c02da50af1852b.tar.bz2
Tests: added PHP tests with "script" and "index" options.
Diffstat (limited to '')
-rw-r--r--test/php/script/phpinfo.php3
-rw-r--r--test/test_php_application.py39
2 files changed, 42 insertions, 0 deletions
diff --git a/test/php/script/phpinfo.php b/test/php/script/phpinfo.php
new file mode 100644
index 00000000..cf608608
--- /dev/null
+++ b/test/php/script/phpinfo.php
@@ -0,0 +1,3 @@
+<?php
+phpinfo();
+?>
diff --git a/test/test_php_application.py b/test/test_php_application.py
index ad520596..ee2048b5 100644
--- a/test/test_php_application.py
+++ b/test/test_php_application.py
@@ -462,6 +462,45 @@ class TestPHPApplication(TestApplicationPHP):
self.get()['body'], r'012345', 'disable_classes before'
)
+ def test_php_application_script(self):
+ self.assertIn(
+ 'success', self.conf(
+ {
+ "listeners": {"*:7080": {"pass": "applications/script"}},
+ "applications": {
+ "script": {
+ "type": "php",
+ "processes": {"spare": 0},
+ "root": self.current_dir + "/php/script",
+ "script": "phpinfo.php",
+ }
+ },
+ }
+ ), 'configure script'
+ )
+
+ resp = self.get()
+
+ self.assertEqual(resp['status'], 200, 'status')
+ self.assertNotEqual(resp['body'], '', 'body not empty')
+
+ def test_php_application_index_default(self):
+ self.assertIn(
+ 'success', self.conf(
+ {
+ "listeners": {"*:7080": {"pass": "applications/phpinfo"}},
+ "applications": {
+ "phpinfo": {
+ "type": "php",
+ "processes": {"spare": 0},
+ "root": self.current_dir + "/php/phpinfo",
+ }
+ },
+ }
+ ), 'configure index default'
+ )
+
+ self.assertEqual(self.get()['status'], 200, 'status')
if __name__ == '__main__':
TestPHPApplication.main()