TestResponse
Implements
Uses
Properties
$streamedContent string
The streamed content of the response.
Methods
__construct ( $response ) : void
Create a new test response instance.
Parameters
- $response Response
fromBaseResponse ( $response ) : static
Create a new TestResponse from another response.
Parameters
- $response Response
assertSuccessful ( ) : $this
Assert that the response has a successful status code.
assertOk ( ) : $this
Assert that the response has a 200 status code.
assertCreated ( ) : $this
Assert that the response has a 201 status code.
assertNoContent ( $status ) : $this
Assert that the response has the given status code and no content.
Parameters
- $status int
assertNotFound ( ) : $this
Assert that the response has a not found status code.
assertForbidden ( ) : $this
Assert that the response has a forbidden status code.
assertUnauthorized ( ) : $this
Assert that the response has an unauthorized status code.
assertUnprocessable ( ) : $this
Assert that the response has a 422 status code.
assertStatus ( $status ) : $this
Assert that the response has the given status code.
Parameters
- $status int
statusMessageWithDetails ( $expected , $actual ) : string
Get an assertion message for a status assertion containing extra details when available.
Parameters
- $expected string|int
- $actual string|int
statusMessageWithException ( $expected , $actual , $exception ) : string
Get an assertion message for a status assertion that has an unexpected exception.
Parameters
- $expected string|int
- $actual string|int
- $exception Throwable
statusMessageWithErrors ( $expected , $actual , $errors ) : string
Get an assertion message for a status assertion that contained errors.
Parameters
- $expected string|int
- $actual string|int
- $errors array
assertRedirect ( $uri ) : $this
Assert whether the response is redirecting to a given URI.
Parameters
- $uri string|null
assertRedirectContains ( $uri ) : $this
Assert whether the response is redirecting to a URI that contains the given URI.
Parameters
- $uri string
assertRedirectToSignedRoute ( $name , $parameters ) : $this
Assert whether the response is redirecting to a given signed route.
Parameters
- $name string|null
- $parameters mixed
assertHeader ( $headerName , $value ) : $this
Asserts that the response contains the given header and equals the optional value.
Parameters
- $headerName string
- $value mixed
assertHeaderMissing ( $headerName ) : $this
Asserts that the response does not contain the given header.
Parameters
- $headerName string
assertLocation ( $uri ) : $this
Assert that the current location header matches the given URI.
Parameters
- $uri string
assertDownload ( $filename ) : $this
Assert that the response offers a file download.
Parameters
- $filename string|null
assertPlainCookie ( $cookieName , $value ) : $this
Asserts that the response contains the given cookie and equals the optional value.
Parameters
- $cookieName string
- $value mixed
assertCookie ( $cookieName , $value , $encrypted , $unserialize ) : $this
Asserts that the response contains the given cookie and equals the optional value.
Parameters
- $cookieName string
- $value mixed
- $encrypted bool
- $unserialize bool
assertCookieExpired ( $cookieName ) : $this
Asserts that the response contains the given cookie and is expired.
Parameters
- $cookieName string
assertCookieNotExpired ( $cookieName ) : $this
Asserts that the response contains the given cookie and is not expired.
Parameters
- $cookieName string
assertCookieMissing ( $cookieName ) : $this
Asserts that the response does not contain the given cookie.
Parameters
- $cookieName string
getCookie ( $cookieName ) : Symfony\...\Cookie|null
Get the given cookie from the response.
Parameters
- $cookieName string
assertSee ( $value , $escape ) : $this
Assert that the given string or array of strings are contained within the response.
Parameters
- $value string|array
- $escape bool
assertSeeInOrder ( array $values , $escape ) : $this
Assert that the given strings are contained in order within the response.
Parameters
- $values array
- $escape bool
assertSeeText ( $value , $escape ) : $this
Assert that the given string or array of strings are contained within the response text.
Parameters
- $value string|array
- $escape bool
assertSeeTextInOrder ( array $values , $escape ) : $this
Assert that the given strings are contained in order within the response text.
Parameters
- $values array
- $escape bool
assertDontSee ( $value , $escape ) : $this
Assert that the given string or array of strings are not contained within the response.
Parameters
- $value string|array
- $escape bool
assertDontSeeText ( $value , $escape ) : $this
Assert that the given string or array of strings are not contained within the response text.
Parameters
- $value string|array
- $escape bool
assertJson ( $value , $strict ) : $this
Assert that the response is a superset of the given JSON.
Parameters
- $value array|callable
- $strict bool
assertJsonPath ( $path , $expect ) : $this
Assert that the expected value and type exists at the given path in the response.
Parameters
- $path string
- $expect mixed
assertExactJson ( array $data ) : $this
Assert that the response has the exact given JSON.
Parameters
- $data array
assertSimilarJson ( array $data ) : $this
Assert that the response has the similar JSON as given.
Parameters
- $data array
assertJsonFragment ( array $data ) : $this
Assert that the response contains the given JSON fragment.
Parameters
- $data array
assertJsonMissing ( array $data , $exact ) : $this
Assert that the response does not contain the given JSON fragment.
Parameters
- $data array
- $exact bool
assertJsonMissingExact ( array $data ) : $this
Assert that the response does not contain the exact JSON fragment.
Parameters
- $data array
assertJsonStructure ( array $structure , $responseData ) : $this
Assert that the response has a given JSON structure.
Parameters
- $structure array|null
- $responseData array|null
assertJsonCount ( int $count , $key ) : $this
Assert that the response JSON has the expected count of items at the given key.
Parameters
- $count int
- $key string|null
assertJsonValidationErrors ( $errors , $responseKey ) : $this
Assert that the response has the given JSON validation errors.
Parameters
- $errors string|array
- $responseKey string
assertJsonValidationErrorFor ( $key , $responseKey ) : $this
Assert the response has any JSON validation errors for the given key.
Parameters
- $key string
- $responseKey string
assertJsonMissingValidationErrors ( $keys , $responseKey ) : $this
Assert that the response has no JSON validation errors for the given keys.
Parameters
- $keys string|array|null
- $responseKey string
json ( $key ) : mixed
Validate and return the decoded response JSON.
Parameters
- $key string|null
assertViewIs ( $value ) : $this
Assert that the response view equals the given value.
Parameters
- $value string
assertViewHas ( $key , $value ) : $this
Assert that the response view has a given piece of bound data.
Parameters
- $key string|array
- $value mixed
assertViewHasAll ( array $bindings ) : $this
Assert that the response view has a given list of bound data.
Parameters
- $bindings array
viewData ( $key ) : mixed
Get a piece of data from the original view.
Parameters
- $key string
assertViewMissing ( $key ) : $this
Assert that the response view is missing a piece of bound data.
Parameters
- $key string
ensureResponseHasView ( ) : $this
Ensure that the response has a view as its original content.
responseHasView ( ) : bool
Determine if the original response is a view.
assertValid ( $keys , $errorBag , $responseKey ) : $this
Assert that the given keys do not have validation errors.
Parameters
- $keys string|array|null
- $errorBag string
- $responseKey string
assertInvalid ( $errors , $errorBag , $responseKey ) : $this
Assert that the response has the given validation errors.
Parameters
- $errors string|array|null
- $errorBag string
- $responseKey string
assertSessionHas ( $key , $value ) : $this
Assert that the session has a given value.
Parameters
- $key string|array
- $value mixed
assertSessionHasAll ( array $bindings ) : $this
Assert that the session has a given list of values.
Parameters
- $bindings array
assertSessionHasInput ( $key , $value ) : $this
Assert that the session has a given value in the flashed input array.
Parameters
- $key string|array
- $value mixed
assertSessionHasErrors ( $keys , $format , $errorBag ) : $this
Assert that the session has the given errors.
Parameters
- $keys string|array
- $format mixed
- $errorBag string
assertSessionDoesntHaveErrors ( $keys , $format , $errorBag ) : $this
Assert that the session is missing the given errors.
Parameters
- $keys string|array
- $format string|null
- $errorBag string
assertSessionHasNoErrors ( ) : $this
Assert that the session has no errors.
assertSessionHasErrorsIn ( $errorBag , $keys , $format ) : $this
Assert that the session has the given errors.
Parameters
- $errorBag string
- $keys string|array
- $format mixed
assertSessionMissing ( $key ) : $this
Assert that the session does not have a given key.
Parameters
- $key string|array
dd ( ) : never
Dump the content from the response and end the script.
ddHeaders ( ) : never
Dump the headers from the response and end the script.
ddSession ( $keys ) : never
Dump the session from the response and end the script.
Parameters
- $keys string|array
dump ( ) : $this
Dump the content from the response.
dumpHeaders ( ) : $this
Dump the headers from the response.
dumpSession ( $keys ) : $this
Dump the session from the response.
Parameters
- $keys string|array
streamedContent ( ) : string
Get the streamed content from the response.
withExceptions ( Collection $exceptions ) : $this
Set the previous exceptions on the response.
Parameters
- $exceptions Collection
__get ( $key ) : mixed
Dynamically access base response parameters.
Parameters
- $key string
__isset ( $key ) : mixed
Proxy isset() checks to the underlying base response.
Parameters
- $key string
offsetExists ( $offset ) : bool
Determine if the given offset exists.
Parameters
- $offset string
offsetGet ( $offset ) : mixed
Get the value for a given offset.
Parameters
- $offset string
offsetSet ( $offset , $value ) : void
Set the value at the given offset.
Parameters
- $offset string
- $value mixed
offsetUnset ( $offset ) : void
Unset the value at the given offset.
Parameters
- $offset string
__call ( $method , $args ) : mixed
Handle dynamic calls into macros or pass missing methods to the base response.
Parameters
- $method string
- $args array