From 5406d1e320eca0a94eeffe2e57e2e2b4d989e0d1 Mon Sep 17 00:00:00 2001 From: Andrei Zeliankou Date: Thu, 20 Feb 2020 21:06:56 +0000 Subject: [PATCH] Tests: added PHP test with invalid index extension only. --- test/test_php_application.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/test_php_application.py b/test/test_php_application.py index 837181e6..37606fa2 100644 --- a/test/test_php_application.py +++ b/test/test_php_application.py @@ -1,4 +1,6 @@ +import os import re +import shutil import unittest from unit.applications.lang.php import TestApplicationPHP @@ -512,5 +514,33 @@ class TestPHPApplication(TestApplicationPHP): self.get(url='/index.wrong')['status'], 200, 'status' ) + new_root = self.testdir + "/php" + os.mkdir(new_root) + shutil.copy(self.current_dir + '/php/phpinfo/index.wrong', new_root) + + self.assertIn( + 'success', + self.conf( + { + "listeners": {"*:7080": {"pass": "applications/phpinfo"}}, + "applications": { + "phpinfo": { + "type": "php", + "processes": {"spare": 0}, + "root": new_root, + "working_directory": new_root, + } + }, + } + ), + 'configure new root', + ) + + resp = self.get() + self.assertNotEqual( + str(resp['status']) + resp['body'], '200', 'status new root' + ) + + if __name__ == '__main__': TestPHPApplication.main()