TestResponse
class TestResponse mixin Response
Traits
Properties
static protected array | $macros | The registered string macros. |
from Macroable |
Response | $baseResponse | The response to delegate to. |
Methods
Dynamically handle calls to the class.
Handle dynamic calls into macros or pass missing methods to the base response.
Assert that the response has a successful status code.
Assert that the response has the given status code.
Assert whether the response is redirecting to a given URI.
Asserts that the response contains the given header and equals the optional value.
Asserts that the response contains the given cookie and equals the optional value.
Asserts that the response contains the given cookie and equals the optional value.
Get the given cookie from the response.
Assert that the given string is contained within the response.
Assert that the given string is contained within the response text.
Assert that the given string is not contained within the response.
Assert that the given string is not contained within the response text.
Assert that the response is a superset of the given JSON.
Get the assertion message for assertJson.
Assert that the response has the exact given JSON.
Assert that the response contains the given JSON fragment.
Assert that the response does not contain the given JSON fragment.
Assert that the response has a given JSON structure.
Validate and return the decoded response JSON.
Validate and return the decoded response JSON.
Assert that the response view equals the given value.
Assert that the response view has a given piece of bound data.
Assert that the response view has a given list of bound data.
Assert that the response view is missing a piece of bound data.
Ensure that the response has a view as its original content.
Assert that the session has a given value.
Assert that the session has a given list of values.
Assert that the session has the given errors.
Assert that the session does not have a given key.
Dump the content from the response.
Dynamically access base response parameters.
Proxy isset() checks to the underlying base response.
Details
in
Macroable at line 24
static void
macro(string $name, callable $macro)
Register a custom macro.
in
Macroable at line 35
static bool
hasMacro(string $name)
Checks if macro is registered.
in
Macroable at line 49
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
at line 649
mixed
__call(string $method, array $args)
Handle dynamic calls into macros or pass missing methods to the base response.
at line 35
void
__construct(Response $response)
Create a new test response instance.
at line 46
static TestResponse
fromBaseResponse(Response $response)
Create a new TestResponse from another response.
at line 56
$this
assertSuccessful()
Assert that the response has a successful status code.
at line 72
$this
assertStatus(int $status)
Assert that the response has the given status code.
at line 90
$this
assertRedirect(string $uri = null)
Assert whether the response is redirecting to a given URI.
at line 110
$this
assertHeader(string $headerName, mixed $value = null)
Asserts that the response contains the given header and equals the optional value.
at line 135
$this
assertPlainCookie(string $cookieName, mixed $value = null)
Asserts that the response contains the given cookie and equals the optional value.
at line 150
$this
assertCookie(string $cookieName, mixed $value = null, bool $encrypted = true)
Asserts that the response contains the given cookie and equals the optional value.
at line 180
protected Cookie|null
getCookie(string $cookieName)
Get the given cookie from the response.
at line 195
$this
assertSee(string $value)
Assert that the given string is contained within the response.
at line 208
$this
assertSeeText(string $value)
Assert that the given string is contained within the response text.
at line 221
$this
assertDontSee(string $value)
Assert that the given string is not contained within the response.
at line 234
$this
assertDontSeeText(string $value)
Assert that the given string is not contained within the response text.
at line 247
$this
assertJson(array $data)
Assert that the response is a superset of the given JSON.
at line 262
protected string
assertJsonMessage(array $data)
Get the assertion message for assertJson.
at line 280
$this
assertExactJson(array $data)
Assert that the response has the exact given JSON.
at line 297
$this
assertJsonFragment(array $data)
Assert that the response contains the given JSON fragment.
at line 324
$this
assertJsonMissing(array $data)
Assert that the response does not contain the given JSON fragment.
at line 352
$this
assertJsonStructure(array $structure = null, array|null $responseData = null)
Assert that the response has a given JSON structure.
at line 386
array
decodeResponseJson()
Validate and return the decoded response JSON.
at line 406
array
json()
Validate and return the decoded response JSON.
at line 417
$this
assertViewIs(string $value)
Assert that the response view equals the given value.
at line 433
$this
assertViewHas(string|array $key, mixed $value = null)
Assert that the response view has a given piece of bound data.
at line 458
$this
assertViewHasAll(array $bindings)
Assert that the response view has a given list of bound data.
at line 477
$this
assertViewMissing(string $key)
Assert that the response view is missing a piece of bound data.
at line 491
protected $this
ensureResponseHasView()
Ensure that the response has a view as its original content.
at line 507
$this
assertSessionHas(string|array $key, mixed $value = null)
Assert that the session has a given value.
at line 531
$this
assertSessionHasAll(array $bindings)
Assert that the session has a given list of values.
at line 551
$this
assertSessionHasErrors(string|array $keys = [], mixed $format = null)
Assert that the session has the given errors.
at line 576
$this
assertSessionMissing(string|array $key)
Assert that the session does not have a given key.
at line 597
protected Store
session()
Get the current session store.
at line 607
void
dump()
Dump the content from the response.
at line 626
mixed
__get(string $key)
Dynamically access base response parameters.
at line 637
mixed
__isset(string $key)
Proxy isset() checks to the underlying base response.