Fork me on Github!
Boomerang!

Documentation Overview

For more information view the full api documentation.

Making a Request

The first step in surface testing your API is making the request. That is done with the HttpRequest object.

Method: HttpRequest->__construct($endpoint [, $responseFactory = null])

Parameters:

Method: HttpRequest->setMethod($method)

Set the request method.

Helper constants exist, for example
$req->setMethod(HttpRequest::POST);  
Parameters:

Method: HttpRequest->setUrlParam($param, $value)

Set a url param by name.

Parameters:

Method: HttpRequest->setUrlParams($params)

Set outgoing params as an array of ParamName => Value

Parameters:

Method: HttpRequest->setHeader($key, $value)

Set an outgoing header by name.

Parameters:

Method: HttpRequest->setHeaders($headers)

Set outgoing headers as an array of HeaderName => Value

Parameters:

Method: HttpRequest->setBasicAuth($username [, $password = ''])

Set outgoing basic auth header.

Parameters:

Method: HttpRequest->setFormValue($key, $value)

Set a named key of the form values
Note that if there is a non-form body set, this will replace it.

Parameters:

Method: HttpRequest->setBody($body)

Set the requests body

Parameters:

Method: HttpRequest->setCookiesFollowRedirects($bool)

Allows you to enable cookie's set by server re-posting following a redirect.
Requires file system storage of a "cookie jar" file and is therefore disabled by default.

Parameters:

Method: HttpRequest->setCookies($cookies)

Set outgoing cookies as an array of CookieName => Value

Parameters:

Method: HttpRequest->setCookie($key, $value)

Set a named cookies outgoing value

Parameters:

Method: HttpRequest->setEndpoint($endpoint)

Sets the request URI

Parameters:

Method: HttpRequest->makeRequest()

Execute the request


Method: HttpRequest->setMaxRedirects($maxRedirects)

Set the maximum number of redirects(hops) a request should follow.

Parameters:

Validating API Expectations

Validators are used to define your expecations for the response.

Method: HttpResponseValidator->expectStatus([ $expected_status = 200 [, $hop = null]])

Verify that the HTTP response code is as expected.

Parameters:

Method: HttpResponseValidator->expectHeader($key, $value [, $hop = null])

Verify that a header field equals an expected value.

Parameters:

Method: HttpResponseValidator->expectHeaderContains($key, $value [, $hop = null])

Verify that a header field contains an expected value.
For example, checking the header Content-Type for "json" would match a response of "application/json"

Parameters:

Method: HttpResponseValidator->expectBody($expectedContent)

Verify that the content body equals an expected value.

Parameters:

Method: HttpResponseValidator->expectBodyContains($expectedContent)

Verify that the content body contains an expected value.

Parameters:

Method: HttpResponseValidator->expectHopCount($expectedCount)

Verify the number of redirection hops is as expected.

Parameters:

Method: JSONValidator->expectStructure($structure)

Verify that the data matches the passed expected structure definition.

Parameters: