1 | <?php |
||
14 | class TutuContext extends RawMinkContext implements SnippetAcceptingContext |
||
|
|||
15 | { |
||
16 | const MAX_PHP_SERVER_RESTARTS = 5; |
||
17 | |||
18 | /** |
||
19 | * @var Process |
||
20 | */ |
||
21 | private $tutuProcess; |
||
22 | |||
23 | /** |
||
24 | * @var int |
||
25 | */ |
||
26 | private $tutuPort; |
||
27 | |||
28 | /** |
||
29 | * @var string; |
||
30 | */ |
||
31 | private $tutuHost; |
||
32 | |||
33 | /** |
||
34 | * @var string |
||
35 | */ |
||
36 | private $webPath; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | private $workDir; |
||
42 | |||
43 | /** |
||
44 | * @var int |
||
45 | */ |
||
46 | private $httpCallAttemptsPerScenario = 0; |
||
47 | |||
48 | public function __construct($webPath) |
||
56 | |||
57 | /** |
||
58 | * @BeforeScenario |
||
59 | */ |
||
60 | public function createWorkDir() |
||
74 | |||
75 | /** @AfterScenario */ |
||
76 | public function printLastResponseWhenScenarioFail(AfterScenarioScope $scope) |
||
84 | |||
85 | /** @AfterScenario */ |
||
86 | public function resetHttpCallAttempts() |
||
90 | |||
91 | /** |
||
92 | * @AfterScenario |
||
93 | */ |
||
94 | public function removeWorkDir() |
||
99 | |||
100 | /** |
||
101 | * @AfterScenario |
||
102 | */ |
||
103 | public function killEveryProcessRunningOnTuTuPort() |
||
108 | |||
109 | /** |
||
110 | * @Given there is a empty responses config file :fileName |
||
111 | */ |
||
112 | public function thereIsAEmptyFile($fileName) |
||
116 | |||
117 | /** |
||
118 | * @Given there is a resource file :fileName with following content |
||
119 | */ |
||
120 | public function thereIsAResourceFileWithFollowingContent($fileName, PyStringNode $fileContent) |
||
130 | |||
131 | /** |
||
132 | * @Given there is a :filePath file with following content |
||
133 | */ |
||
134 | public function thereIsAFileWithFollowingContent($filePath, PyStringNode $fileContent) |
||
139 | |||
140 | /** |
||
141 | * @Given there is a routing file :fileName with following content: |
||
142 | * @Given there is a responses config file :fileName with following content: |
||
143 | * @Given there is a config file :fileName with following content: |
||
144 | */ |
||
145 | public function thereIsARoutingFileWithFollowingContent($fileName, PyStringNode $fileContent) |
||
158 | |||
159 | /** |
||
160 | * @Given TuTu is running on host :host at port :port |
||
161 | */ |
||
162 | public function tutuIsRunningOnHostAtPort($host, $port) |
||
186 | |||
187 | /** |
||
188 | * @Then print last response |
||
189 | */ |
||
190 | public function printLastResponse() |
||
196 | |||
197 | /** |
||
198 | * @Then response status code should be :expectedStatus |
||
199 | */ |
||
200 | public function responseStatusCodeShouldBe($expectedStatus) |
||
207 | |||
208 | /** |
||
209 | * @Then the response content should be equal to: |
||
210 | */ |
||
211 | public function theResponseContentShouldBeEqualTo(PyStringNode $expectedContent) |
||
218 | |||
219 | /** |
||
220 | * @Then the response content should match expression: |
||
221 | */ |
||
222 | public function theResponseContentShouldMatchExpression(PyStringNode $pattern) |
||
227 | |||
228 | /** |
||
229 | * @Then the response content should be empty |
||
230 | */ |
||
231 | public function theResponseContentShouldBeEmpty() |
||
238 | |||
239 | /** |
||
240 | * @Then response should have following hedaers: |
||
241 | */ |
||
242 | public function responseShouldHaveFollowingHedaers(TableNode $responseHeaders) |
||
261 | |||
262 | |||
263 | /** |
||
264 | * @When http client sends :method request on :url |
||
265 | */ |
||
266 | public function httpClientSendRequestOn($method, $url) |
||
270 | |||
271 | /** |
||
272 | * @When http client sends :method request on :url with following parameters: |
||
273 | */ |
||
274 | public function httpClientSendPostRequestOnWithFollowingParameters($method, $url, TableNode $parametersTable) |
||
283 | |||
284 | /** |
||
285 | * @When http client sends :method request on :url with following headers |
||
286 | */ |
||
287 | public function httpClientSendGetRequestOnWithFollowingHeaders($method, $url, TableNode $headersTable) |
||
299 | |||
300 | /** |
||
301 | * @When http client sends :method request on :url with body |
||
302 | */ |
||
303 | public function httpClientSendGetRequestOnWithBody($method, $url, PyStringNode $body) |
||
307 | |||
308 | /** |
||
309 | * @param $method |
||
310 | * @param $url |
||
311 | * @param array $parameters |
||
312 | * @param null $body |
||
313 | */ |
||
314 | private function makeHttpCall($method, $url, array $parameters = [], array $headers = [], $body = null) |
||
341 | } |
||
342 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.