Open Journal Systems
3.3.0
|
Public Member Functions | |
__construct ($port=null) | |
enqueue ($responses) | |
flush () | |
getPort () | |
getReceivedRequests ($hydrate=false) | |
getUrl () | |
isRunning () | |
start () | |
stop () | |
Data Fields | |
const | DEFAULT_PORT = 8124 |
const | REQUEST_DELIMITER = "\n----[request]\n" |
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 {
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.
Definition at line 27 of file Server.php.
Guzzle\Tests\Http\Server::__construct | ( | $port = null | ) |
Create a new scripted server
int | $port | Port to listen on (defaults to 8124) |
Definition at line 55 of file Server.php.
References Guzzle\Tests\Http\Server\DEFAULT_PORT, and Guzzle\Tests\Http\Server\getUrl().
Guzzle\Tests\Http\Server::enqueue | ( | $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 | Response | $responses | A single or array of Responses to queue |
BadResponseException |
Definition at line 80 of file Server.php.
References Guzzle\Http\Message\Response\fromMessage().
Guzzle\Tests\Http\Server::flush | ( | ) |
Flush the received requests from the server
RuntimeException |
Definition at line 66 of file Server.php.
Guzzle\Tests\Http\Server::getPort | ( | ) |
Get the port that the server is listening on
Definition at line 139 of file Server.php.
Referenced by Guzzle\Tests\Http\Server\getUrl().
Guzzle\Tests\Http\Server::getReceivedRequests | ( | $hydrate = false | ) |
Get all of the received requests
bool | $hydrate | Set to TRUE to turn the messages into actual { |
RuntimeException |
Definition at line 154 of file Server.php.
References Guzzle\Http\Message\RequestFactory\getInstance().
Guzzle\Tests\Http\Server::getUrl | ( | ) |
Get the URL to the server
Definition at line 129 of file Server.php.
References Guzzle\Tests\Http\Server\getPort().
Referenced by Guzzle\Tests\Http\Server\__construct().
Guzzle\Tests\Http\Server::isRunning | ( | ) |
Check if the server is running
Definition at line 109 of file Server.php.
Referenced by Guzzle\Tests\Http\Server\start(), and Guzzle\Tests\Http\Server\stop().
Guzzle\Tests\Http\Server::start | ( | ) |
Start running the node.js server in the background
Definition at line 170 of file Server.php.
References Guzzle\Tests\Http\Server\isRunning().
Guzzle\Tests\Http\Server::stop | ( | ) |
Stop running the node.js server
Definition at line 191 of file Server.php.
References Guzzle\Tests\Http\Server\isRunning().
const Guzzle\Tests\Http\Server::DEFAULT_PORT = 8124 |
Definition at line 29 of file Server.php.
Referenced by Guzzle\Tests\Http\Server\__construct().
const Guzzle\Tests\Http\Server::REQUEST_DELIMITER = "\n----[request]\n" |
Definition at line 30 of file Server.php.