DEFAULT_PORT
DEFAULT_PORT = 8124
The Server class is used to control a scripted webserver using node.js that will respond to HTTP requests with queued responses.
Queued responses will be served to requests using a FIFO order. All requests received by the server are stored on the node.js server and can be retrieved by calling \Guzzle\Tests\Http\Server::getReceivedRequests().
Mock responses that don't require data to be transmitted over HTTP a great for testing. Mock response, however, cannot test the actual sending of an HTTP request using cURL. This test server allows the simulation of any number of HTTP request response transactions to test the actual sending of requests over the wire without having to leave an internal network.
$client : \Guzzle\Http\Client
enqueue(array|\Guzzle\Http\Message\Response $responses)
Queue an array of responses or a single response on the server.
Any currently queued responses will be overwritten. Subsequent requests on the server will return queued responses in FIFO order.
array|\Guzzle\Http\Message\Response | $responses | A single or array of Responses to queue |
getReceivedRequests(boolean $hydrate = false) : array
Get all of the received requests
boolean | $hydrate | Set to TRUE to turn the messages into actual {@see RequestInterface} objects. If $hydrate is FALSE, requests will be returned as strings. |