Properties

Methods

__construct()

__construct(\CodeIgniter\HTTP\Response  $response = null) 

Constructor.

Parameters

\CodeIgniter\HTTP\Response $response

isOK()

isOK() : boolean

Boils down the possible responses into a bolean valid/not-valid response type.

Returns

boolean

isRedirect()

isRedirect() : boolean

Returns whether or not the Response was a redirect response

Returns

boolean

assertRedirect()

assertRedirect() 

Assert that the given response was a redirect.

Throws

\Exception

assertStatus()

assertStatus(integer  $code) 

Asserts that the status is a specific value.

Parameters

integer $code

Throws

\Exception

assertOK()

assertOK() 

Asserts that the Response is considered OK.

Throws

\Exception

assertSessionHas()

assertSessionHas(string  $key, null  $value = null) 

Asserts that an SESSION key has been set and, optionally, test it's value.

Parameters

string $key
null $value

Throws

\Exception

assertSessionMissing()

assertSessionMissing(string  $key) 

Asserts the session is missing $key.

Parameters

string $key

Throws

\Exception

assertHeader()

assertHeader(string  $key, null  $value = null) 

Asserts that the Response contains a specific header.

Parameters

string $key
null $value

Throws

\Exception

assertHeaderMissing()

assertHeaderMissing(string  $key) 

Asserts the Response headers does not contain the specified header.

Parameters

string $key

Throws

\Exception

assertCookie()

assertCookie(string  $key, null  $value = null, string|null  $prefix = '') 

Asserts that the response has the specified cookie.

Parameters

string $key
null $value
string|null $prefix

Throws

\Exception

assertCookieMissing()

assertCookieMissing(string  $key) 

Assert the Response does not have the specified cookie set.

Parameters

string $key

assertCookieExpired()

assertCookieExpired(string  $key, string  $prefix = '') 

Asserts that a cookie exists and has an expired time.

Parameters

string $key
string $prefix

Throws

\Exception

assertSee()

assertSee(string|null  $search = null, string|null  $element = null) 

Assert that the desired text can be found in the result body.

Parameters

string|null $search
string|null $element

Throws

\Exception

assertDontSee()

assertDontSee(string|null  $search = null, string|null  $element = null) 

Asserts that we do not see the specified text.

Parameters

string|null $search
string|null $element

Throws

\Exception

assertSeeElement()

assertSeeElement(string  $search) 

Assert that we see an element selected via a CSS selector.

Parameters

string $search

Throws

\Exception

assertDontSeeElement()

assertDontSeeElement(string  $search) 

Assert that we do not see an element selected via a CSS selector.

Parameters

string $search

Throws

\Exception

assertSeeLink()

assertSeeLink(string  $text, string|null  $details = null) 

Assert that we see a link with the matching text and/or class.

Parameters

string $text
string|null $details

Throws

\Exception

assertSeeInField()

assertSeeInField(string  $field, string|null  $value = null) 

Assert that we see an input with name/value.

Parameters

string $field
string|null $value

Throws

\Exception

getJSON()

getJSON() : mixed|false

Returns the response's body as JSON

Returns

mixed|false

assertJSONFragment()

assertJSONFragment(array  $fragment) 

Test that the response contains a matching JSON fragment.

Parameters

array $fragment

Throws

\Exception

assertJSONExact()

assertJSONExact(string|array  $test) 

Asserts that the JSON exactly matches the passed in data.

If the value being passed in is a string, it must be a json_encoded string.

Parameters

string|array $test

Throws

\Exception

getXML()

getXML() : mixed|string

Returns the response' body as XML

Returns

mixed|string