class Illuminate / Testing / AssertableJsonString

AssertableJsonString

Implements

Properties

public

$json Jsonable |JsonSerializable |array|string

The original encoded json.

Default: null
protected

$decoded array|null

The decoded json contents.

Default: null

Methods

public

__construct ( $jsonable ) : void

Create a new assertable JSON string instance.

Parameters

public

json ( $key ) : mixed

Validate and return the decoded response JSON.

Parameters

  • $key string|null
public

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
public

assertExact ( array $data ) : $this

Assert that the response has the exact given JSON.

Parameters

  • $data array
public

assertSimilar ( array $data ) : $this

Assert that the response has the similar JSON as given.

Parameters

  • $data array
public

assertFragment ( array $data ) : $this

Assert that the response contains the given JSON fragment.

Parameters

  • $data array
public

assertMissing ( array $data , $exact ) : $this

Assert that the response does not contain the given JSON fragment.

Parameters

  • $data array
  • $exact bool
public

assertMissingExact ( array $data ) : $this

Assert that the response does not contain the exact JSON fragment.

Parameters

  • $data array
public

assertMissingPath ( $path ) : $this

Assert that the response does not contain the given path.

Parameters

  • $path string
public

assertPath ( $path , $expect ) : $this

Assert that the expected value and type exists at the given path in the response.

Parameters

  • $path string
  • $expect mixed
public

assertStructure ( array $structure , $responseData ) : $this

Assert that the response has a given JSON structure.

Parameters

  • $structure array|null
  • $responseData array|null
public

assertSubset ( array $data , $strict ) : $this

Assert that the response is a superset of the given JSON.

Parameters

  • $data array
  • $strict bool
protected

reorderAssocKeys ( array $data ) : array

Reorder associative array keys to make it easy to compare arrays.

Parameters

  • $data array
protected

assertJsonMessage ( array $data ) : string

Get the assertion message for assertJson.

Parameters

  • $data array
protected

jsonSearchStrings ( $key , $value ) : array

Get the strings we need to search for when examining the JSON.

Parameters

  • $key string
  • $value string
public

count ( ) : int

Get the total number of items in the underlying JSON array.

public

offsetExists ( $offset ) : bool

Determine whether an offset exists.

Parameters

  • $offset mixed
public

offsetGet ( $offset ) : mixed

Get the value at the given offset.

Parameters

  • $offset string
public

offsetSet ( $offset , $value ) : void

Set the value at the given offset.

Parameters

  • $offset string
  • $value mixed
public

offsetUnset ( $offset ) : void

Unset the value at the given offset.

Parameters

  • $offset string