| @@ 213-230 (lines=18) @@ | ||
| 210 | * @param string $method |
|
| 211 | * @param string $url |
|
| 212 | */ |
|
| 213 | public function sendingAToWithRequesttoken($method, $url) { |
|
| 214 | $baseUrl = substr($this->baseUrl, 0, -5); |
|
| 215 | ||
| 216 | $client = new Client(); |
|
| 217 | $request = $client->createRequest( |
|
| 218 | $method, |
|
| 219 | $baseUrl . $url, |
|
| 220 | [ |
|
| 221 | 'cookies' => $this->cookieJar, |
|
| 222 | ] |
|
| 223 | ); |
|
| 224 | $request->addHeader('requesttoken', $this->requestToken); |
|
| 225 | try { |
|
| 226 | $this->response = $client->send($request); |
|
| 227 | } catch (\GuzzleHttp\Exception\ClientException $e) { |
|
| 228 | $this->response = $e->getResponse(); |
|
| 229 | } |
|
| 230 | } |
|
| 231 | ||
| 232 | /** |
|
| 233 | * @When Sending a :method to :url without requesttoken |
|
| @@ 237-253 (lines=17) @@ | ||
| 234 | * @param string $method |
|
| 235 | * @param string $url |
|
| 236 | */ |
|
| 237 | public function sendingAToWithoutRequesttoken($method, $url) { |
|
| 238 | $baseUrl = substr($this->baseUrl, 0, -5); |
|
| 239 | ||
| 240 | $client = new Client(); |
|
| 241 | $request = $client->createRequest( |
|
| 242 | $method, |
|
| 243 | $baseUrl . $url, |
|
| 244 | [ |
|
| 245 | 'cookies' => $this->cookieJar, |
|
| 246 | ] |
|
| 247 | ); |
|
| 248 | try { |
|
| 249 | $this->response = $client->send($request); |
|
| 250 | } catch (\GuzzleHttp\Exception\ClientException $e) { |
|
| 251 | $this->response = $e->getResponse(); |
|
| 252 | } |
|
| 253 | } |
|
| 254 | ||
| 255 | public static function removeFile($path, $filename){ |
|
| 256 | if (file_exists("$path" . "$filename")) { |
|