1 | <?php |
||
47 | trait VarnishTest |
||
48 | { |
||
49 | /** |
||
50 | * @var VarnishProxy |
||
51 | */ |
||
52 | protected $proxy; |
||
53 | |||
54 | /** |
||
55 | * @var Varnish |
||
56 | */ |
||
57 | protected $proxyClient; |
||
58 | |||
59 | /** |
||
60 | * Start Varnish and discard any cached content. |
||
61 | */ |
||
62 | 23 | protected function setUp() |
|
63 | { |
||
64 | 23 | $this->getProxy()->clear(); |
|
65 | 23 | } |
|
66 | |||
67 | /** |
||
68 | * Stop Varnish. |
||
69 | */ |
||
70 | 24 | protected function tearDown() |
|
74 | |||
75 | /** |
||
76 | * The default implementation looks at the constant VARNISH_FILE. |
||
77 | * |
||
78 | * @throws \Exception |
||
79 | * |
||
80 | * @return string the path to the varnish server configuration file to use with this test |
||
81 | */ |
||
82 | 11 | protected function getConfigFile() |
|
94 | |||
95 | /** |
||
96 | * Get Varnish binary. |
||
97 | * |
||
98 | * @return string |
||
99 | */ |
||
100 | 23 | protected function getBinary() |
|
104 | |||
105 | /** |
||
106 | * Get Varnish port. |
||
107 | * |
||
108 | * @return int |
||
109 | */ |
||
110 | 23 | protected function getCachingProxyPort() |
|
114 | |||
115 | /** |
||
116 | * Get Varnish management port. |
||
117 | * |
||
118 | * @return int |
||
119 | */ |
||
120 | 23 | protected function getVarnishMgmtPort() |
|
124 | |||
125 | /** |
||
126 | * Get Varnish cache directory. |
||
127 | * |
||
128 | * @return string |
||
129 | */ |
||
130 | 23 | protected function getCacheDir() |
|
134 | |||
135 | /** |
||
136 | * Defaults to 4. |
||
137 | * |
||
138 | * @return int |
||
139 | */ |
||
140 | 13 | protected function getVarnishVersion() |
|
144 | |||
145 | /** |
||
146 | * {@inheritdoc} |
||
147 | */ |
||
148 | 24 | protected function getProxy() |
|
171 | |||
172 | /** |
||
173 | * Get Varnish proxy client. |
||
174 | * |
||
175 | * @return Varnish |
||
176 | */ |
||
177 | 10 | protected function getProxyClient() |
|
199 | |||
200 | /** |
||
201 | * Get the hostname where your application can be reached. |
||
202 | * |
||
203 | * @throws \Exception |
||
204 | * |
||
205 | * @return string |
||
206 | */ |
||
207 | 23 | protected function getHostName() |
|
219 | } |
||
220 |