@@ -212,6 +212,10 @@ Response constructor.
212
212
213
213
## Class: \donatj\MockWebServer\ResponseStack
214
214
215
+ ResponseStack is used to store multiple responses for a request issued by the server in order.
216
+
217
+ When the stack is empty, the server will return a customizable response defaulting to a 404.
218
+
215
219
### Method: ResponseStack->__ construct
216
220
217
221
``` php
@@ -230,6 +234,8 @@ Accepts a variable number of RequestInterface objects
230
234
function getPastEndResponse()
231
235
```
232
236
237
+ Gets the response returned when the stack is exhausted.
238
+
233
239
#### Returns:
234
240
235
241
- *** \donatj\MockWebServer\ResponseInterface***
@@ -242,12 +248,16 @@ function getPastEndResponse()
242
248
function setPastEndResponse(\donatj\MockWebServer\ResponseInterface $pastEndResponse)
243
249
```
244
250
251
+ Set the response to return when the stack is exhausted.
252
+
245
253
#### Parameters:
246
254
247
255
- *** \donatj\MockWebServer\ResponseInterface*** ` $pastEndResponse `
248
256
249
257
## Class: \donatj\MockWebServer\ResponseByMethod
250
258
259
+ ResponseByMethod is used to vary the response to a request by the called HTTP Method.
260
+
251
261
``` php
252
262
<?php
253
263
namespace donatj\MockWebServer;
@@ -274,7 +284,7 @@ MethodResponse constructor.
274
284
275
285
#### Parameters:
276
286
277
- - *** \donatj\MockWebServer\ResponseInterface[ ] *** ` $responses ` - An array of responses keyed by their method.
287
+ - *** \donatj\MockWebServer\ResponseInterface[ ] *** ` $responses ` - A map of responses keyed by their method.
278
288
- *** \donatj\MockWebServer\ResponseInterface*** | *** null*** ` $defaultResponse ` - The fallthrough response to return if a response for a given
279
289
method is not found. If this is not defined the server will return an HTTP 501 error.
280
290
@@ -297,6 +307,8 @@ Set the Response for the Given Method
297
307
298
308
DelayedResponse wraps a response, causing it when called to be delayed by a specified number of microseconds.
299
309
310
+ This is useful for simulating slow responses and testing timeouts.
311
+
300
312
### Method: DelayedResponse->__ construct
301
313
302
314
``` php
0 commit comments