1 | <?php |
||
41 | trait NginxTest |
||
42 | { |
||
43 | /** |
||
44 | * @var Nginx |
||
45 | */ |
||
46 | protected $proxyClient; |
||
47 | |||
48 | /** |
||
49 | * @var NginxProxy |
||
50 | */ |
||
51 | protected $proxy; |
||
52 | |||
53 | 6 | protected function setUp() |
|
57 | |||
58 | 6 | protected function tearDown() |
|
62 | |||
63 | /** |
||
64 | * The default implementation looks at the constant NGINX_FILE. |
||
65 | * |
||
66 | * @throws \Exception |
||
67 | * |
||
68 | * @return string the path to the NGINX server configuration file to use with this test. |
||
69 | */ |
||
70 | 6 | protected function getConfigFile() |
|
71 | { |
||
72 | 6 | if (!defined('NGINX_FILE')) { |
|
73 | throw new \Exception( |
||
74 | 'Specify the NGINX' |
||
75 | .' configuration file path in phpunit.xml or override getConfigFile()' |
||
76 | ); |
||
77 | } |
||
78 | |||
79 | // NGINX needs an absolute path |
||
80 | 6 | return realpath(NGINX_FILE); |
|
81 | } |
||
82 | |||
83 | /** |
||
84 | * Defaults to "nginx". |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | 6 | protected function getBinary() |
|
92 | |||
93 | /** |
||
94 | * Defaults to 8088. |
||
95 | * |
||
96 | * @return int |
||
97 | */ |
||
98 | 6 | protected function getCachingProxyPort() |
|
102 | |||
103 | /** |
||
104 | * Get NGINX cache directory. |
||
105 | */ |
||
106 | 6 | protected function getCacheDir() |
|
110 | |||
111 | /** |
||
112 | * Get the hostname where your application can be reached. |
||
113 | * |
||
114 | * @throws \Exception |
||
115 | * |
||
116 | * @return string |
||
117 | */ |
||
118 | 6 | protected function getHostName() |
|
128 | |||
129 | /** |
||
130 | * @return NginxProxy |
||
131 | */ |
||
132 | 6 | protected function getProxy() |
|
149 | |||
150 | /** |
||
151 | * Get proxy client. |
||
152 | * |
||
153 | * @param string $purgeLocation Optional purgeLocation |
||
154 | * |
||
155 | * @return Nginx |
||
156 | */ |
||
157 | protected function getProxyClient($purgeLocation = '') |
||
170 | } |
||
171 |