class AssertableJsonString implements ArrayAccess, Countable (View source)
Jsonable|JsonSerializable|array | $json | The original encoded json. | |
protected array|null | $decoded | The decoded json contents. |
void | __construct(Jsonable|JsonSerializable|array|string $jsonable) Create a new assertable JSON string instance. | |
mixed | json(string|null $key = null) Validate and return the decoded response JSON. | |
$this | assertCount(int $count, string|null $key = null) Assert that the response JSON has the expected count of items at the given key. | |
$this | assertExact(array $data) Assert that the response has the exact given JSON. | |
$this | assertSimilar(array $data) Assert that the response has the similar JSON as given. | |
$this | assertFragment(array $data) Assert that the response contains the given JSON fragment. | |
$this | assertMissing(array $data, bool $exact = false) Assert that the response does not contain the given JSON fragment. | |
$this | assertMissingExact(array $data) Assert that the response does not contain the exact JSON fragment. | |
$this | assertPath(string $path, mixed $expect) Assert that the expected value and type exists at the given path in the response. | |
$this | assertStructure(array $structure = null, array|null $responseData = null) Assert that the response has a given JSON structure. | |
$this | assertSubset(array $data, bool $strict = false) Assert that the response is a superset of the given JSON. | |
array | reorderAssocKeys(array $data) Reorder associative array keys to make it easy to compare arrays. | |
string | assertJsonMessage(array $data) Get the assertion message for assertJson. | |
array | jsonSearchStrings(string $key, string $value) Get the strings we need to search for when examining the JSON. | |
int | count() Get the total number of items in the underlying JSON array. | |
bool | offsetExists(mixed $offset) Determine whether an offset exists. | |
mixed | offsetGet(string $offset) Get the value at the given offset. | |
void | offsetSet(string $offset, mixed $value) Set the value at the given offset. | |
void | offsetUnset(string $offset) Unset the value at the given offset. |
Create a new assertable JSON string instance.
Validate and return the decoded response JSON.
Assert that the response JSON has the expected count of items at the given key.
Assert that the response has the exact given JSON.
Assert that the response has the similar JSON as given.
Assert that the response contains the given JSON fragment.
Assert that the response does not contain the given JSON fragment.
Assert that the response does not contain the exact JSON fragment.
Assert that the expected value and type exists at the given path in the response.
Assert that the response has a given JSON structure.
Assert that the response is a superset of the given JSON.
Reorder associative array keys to make it easy to compare arrays.
Get the assertion message for assertJson.
Get the strings we need to search for when examining the JSON.
Get the total number of items in the underlying JSON array.
Determine whether an offset exists.
Get the value at the given offset.
Set the value at the given offset.
Unset the value at the given offset.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Testing/AssertableJsonString.html