Tests: added PHP tests with "script" and "index" options.

This commit is contained in:
Andrey Zelenkov 2019-07-17 16:50:24 +03:00
parent dcf46a63eb
commit 4153fad89d
2 changed files with 42 additions and 0 deletions

View file

@ -0,0 +1,3 @@
<?php
phpinfo();
?>

View file

@ -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()