MakesHttpRequests
trait MakesHttpRequests
Properties
protected array | $serverVariables | Additional server variables for the request. |
Methods
Define a set of server variables to be sent with the requests.
Disable middleware for the test.
Visit the given URI with a GET request.
Visit the given URI with a GET request, expecting a JSON response.
Visit the given URI with a POST request.
Visit the given URI with a POST request, expecting a JSON response.
Visit the given URI with a PUT request.
Visit the given URI with a PUT request, expecting a JSON response.
Visit the given URI with a PATCH request.
Visit the given URI with a PATCH request, expecting a JSON response.
Visit the given URI with a DELETE request.
Visit the given URI with a DELETE request, expecting a JSON response.
Call the given URI with a JSON request.
Call the given URI and return the Response.
Turn the given URI into a fully qualified URL.
Transform headers array to array of $SERVER vars with HTTP* format.
Format the header name for the server array.
Extract the file uploads from the given data array.
Details
at line 27
$this
withServerVariables(array $server)
Define a set of server variables to be sent with the requests.
at line 39
$this
withoutMiddleware()
Disable middleware for the test.
at line 53
TestResponse
get(string $uri, array $headers = [])
Visit the given URI with a GET request.
at line 67
TestResponse
getJson(string $uri, array $headers = [])
Visit the given URI with a GET request, expecting a JSON response.
at line 80
TestResponse
post(string $uri, array $data = [], array $headers = [])
Visit the given URI with a POST request.
at line 95
TestResponse
postJson(string $uri, array $data = [], array $headers = [])
Visit the given URI with a POST request, expecting a JSON response.
at line 108
TestResponse
put(string $uri, array $data = [], array $headers = [])
Visit the given URI with a PUT request.
at line 123
TestResponse
putJson(string $uri, array $data = [], array $headers = [])
Visit the given URI with a PUT request, expecting a JSON response.
at line 136
TestResponse
patch(string $uri, array $data = [], array $headers = [])
Visit the given URI with a PATCH request.
at line 151
TestResponse
patchJson(string $uri, array $data = [], array $headers = [])
Visit the given URI with a PATCH request, expecting a JSON response.
at line 164
TestResponse
delete(string $uri, array $data = [], array $headers = [])
Visit the given URI with a DELETE request.
at line 179
TestResponse
deleteJson(string $uri, array $data = [], array $headers = [])
Visit the given URI with a DELETE request, expecting a JSON response.
at line 193
TestResponse
json(string $method, string $uri, array $data = [], array $headers = [])
Call the given URI with a JSON request.
at line 222
TestResponse
call(string $method, string $uri, array $parameters = [], array $cookies = [], array $files = [], array $server = [], string $content = null)
Call the given URI and return the Response.
at line 248
protected string
prepareUrlForRequest(string $uri)
Turn the given URI into a fully qualified URL.
at line 267
protected array
transformHeadersToServerVars(array $headers)
Transform headers array to array of $SERVER vars with HTTP* format.
at line 282
protected string
formatServerHeaderKey(string $name)
Format the header name for the server array.
at line 297
protected array
extractFilesFromDataArray(array $data)
Extract the file uploads from the given data array.
at line 324
protected TestResponse
createTestResponse(Response $response)
Create the test response instance from the given response.