AssertableJsonString
Implements
Properties
$decoded array|null
The decoded json contents.
Methods
__construct ( $jsonable ) : void
Create a new assertable JSON string instance.
Parameters
- $jsonable Jsonable |JsonSerializable |array|string
json ( $key ) : mixed
Validate and return the decoded response JSON.
Parameters
- $key string|null
assertCount ( 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
assertExact ( array $data ) : $this
Assert that the response has the exact given JSON.
Parameters
- $data array
assertSimilar ( array $data ) : $this
Assert that the response has the similar JSON as given.
Parameters
- $data array
assertFragment ( array $data ) : $this
Assert that the response contains the given JSON fragment.
Parameters
- $data array
assertMissing ( array $data , $exact ) : $this
Assert that the response does not contain the given JSON fragment.
Parameters
- $data array
- $exact bool
assertMissingExact ( array $data ) : $this
Assert that the response does not contain the exact JSON fragment.
Parameters
- $data array
assertPath ( $path , $expect ) : $this
Assert that the expected value and type exists at the given path in the response.
Parameters
- $path string
- $expect mixed
assertStructure ( array $structure , $responseData ) : $this
Assert that the response has a given JSON structure.
Parameters
- $structure array|null
- $responseData array|null
assertSubset ( array $data , $strict ) : $this
Assert that the response is a superset of the given JSON.
Parameters
- $data array
- $strict bool
reorderAssocKeys ( array $data ) : array
Reorder associative array keys to make it easy to compare arrays.
Parameters
- $data array
assertJsonMessage ( array $data ) : string
Get the assertion message for assertJson.
Parameters
- $data array
jsonSearchStrings ( $key , $value ) : array
Get the strings we need to search for when examining the JSON.
Parameters
- $key string
- $value string
count ( ) : int
Get the total number of items in the underlying JSON array.
offsetExists ( $offset ) : bool
Determine whether an offset exists.
Parameters
- $offset mixed
offsetGet ( $offset ) : mixed
Get the value at the 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