php.py (1670:099c23b00eaf) php.py (1673:883f2f79c2f6)
1from conftest import option
1from conftest import option
2import os
3import shutil
4
2from unit.applications.proto import TestApplicationProto
3
4
5class TestApplicationPHP(TestApplicationProto):
6 application_type = "php"
7
8 def load(self, script, index='index.php', **kwargs):
9 script_path = option.test_dir + '/php/' + script
10
5from unit.applications.proto import TestApplicationProto
6
7
8class TestApplicationPHP(TestApplicationProto):
9 application_type = "php"
10
11 def load(self, script, index='index.php', **kwargs):
12 script_path = option.test_dir + '/php/' + script
13
14 if kwargs.get('isolation') and kwargs['isolation'].get('rootfs'):
15 rootfs = kwargs['isolation']['rootfs']
16
17 if not os.path.exists(rootfs + '/app/php/'):
18 os.makedirs(rootfs + '/app/php/')
19
20 if not os.path.exists(rootfs + '/app/php/' + script):
21 shutil.copytree(script_path, rootfs + '/app/php/' + script)
22
23 script_path = '/app/php/' + script
24
11 self._load_conf(
12 {
13 "listeners": {"*:7080": {"pass": "applications/" + script}},
14 "applications": {
15 script: {
16 "type": self.get_application_type(),
17 "processes": {"spare": 0},
18 "root": script_path,
19 "working_directory": script_path,
20 "index": index,
21 }
22 },
23 },
24 **kwargs
25 )
25 self._load_conf(
26 {
27 "listeners": {"*:7080": {"pass": "applications/" + script}},
28 "applications": {
29 script: {
30 "type": self.get_application_type(),
31 "processes": {"spare": 0},
32 "root": script_path,
33 "working_directory": script_path,
34 "index": index,
35 }
36 },
37 },
38 **kwargs
39 )