class AssertableJson implements Arrayable (View source)
| Has | |
| Matching | |
| Debugging | |
| Interaction | |
| Conditionable | |
| Macroable | |
| Tappable | |
| Dumpable |
| protected array | $interacted | The list of interacted properties. | from Interaction |
| static protected array | $macros | The registered string macros. | from Macroable |
| Has | count(string|int $key, int|null $length = null)
Assert that the prop is of the expected size. | from Has |
| $this | has(string $key, null $value = null, Closure|null $scope = null)
Ensure that the given prop exists. | from Matching |
| Has | hasAll(array|string $key)
Assert that all of the given props exist. | from Has |
| Has | hasAny(array|string $key)
Assert that at least one of the given props exists. | from Has |
| Has | missingAll(array|string $key)
Assert that none of the given props exist. | from Has |
| Has | missing(string $key)
Assert that the given prop does not exist. | from Has |
| string | dotPath(string $key = '')
Compose the absolute "dot" path to the given key. | |
| void | interactsWith(string $key)
Marks the property as interacted. | from Interaction |
| mixed | prop(string|null $key = null)
Retrieve a prop within the current scope using "dot" notation. | |
| AssertableJson | scope(string $key, Closure $callback)
Instantiate a new "scope" at the path of the given key. | |
| Interaction | etc()
Disables the interaction check. | from Interaction |
| AssertableJson | first(Closure $callback)
Instantiate a new "scope" on the first child element. | |
| Matching | where(string $key, mixed|Closure $expected)
Asserts that the property matches the expected value. | from Matching |
| Matching | whereNot(string $key, mixed|Closure $expected)
Asserts that the property does not match the expected value. | from Matching |
| Matching | whereAll(array $bindings)
Asserts that all properties match their expected values. | from Matching |
| Matching | whereType(string $key, string|array $expected)
Asserts that the property is of the expected type. | from Matching |
| Matching | whereAllType(array $bindings)
Asserts that all properties are of their expected types. | from Matching |
| $this | whereContains(string $key, mixed $expected)
Asserts that the property contains the expected values. | from Matching |
| void | ensureSorted(mixed $value)
Ensures that all properties are sorted the same way, recursively. | from Matching |
| never | dd(mixed ...$args)
Dump the given arguments and terminate execution. | from Dumpable |
| $this | dump(mixed ...$args)
Dump the given arguments. | from Dumpable |
| void | interacted()
Asserts that all properties have been interacted with. | from Interaction |
| $this|TWhenReturnType | when($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy. | from Conditionable |
| $this|TUnlessReturnType | unless($value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy. | from Conditionable |
| static void | macro(string $name, object|callable $macro)
Register a custom macro. | from Macroable |
| static void | mixin(object $mixin, bool $replace = true)
Mix another object into the class. | from Macroable |
| static bool | hasMacro(string $name)
Checks if macro is registered. | from Macroable |
| static void | flushMacros()
Flush the existing macros. | from Macroable |
| static mixed | __callStatic(string $method, array $parameters)
Dynamically handle calls to the class. | from Macroable |
| mixed | __call(string $method, array $parameters)
Dynamically handle calls to the class. | from Macroable |
| tap($callback = null)
Call the given Closure with this instance then return the instance. | from Tappable | |
| void | __construct(array $props, string|null $path = null)
Create a new fluent, assertable JSON data instance. | |
| AssertableJson | each(Closure $callback)
Instantiate a new "scope" on each child element. | |
| static AssertableJson | fromArray(array $data)
Create a new instance from an array. | |
| static AssertableJson | fromAssertableJsonString(AssertableJsonString $json)
Create a new instance from an AssertableJsonString. | |
| toArray()
Get the instance as an array. |
Assert that the prop is of the expected size.
Ensure that the given prop exists.
Assert that all of the given props exist.
Assert that at least one of the given props exists.
Assert that none of the given props exist.
Assert that the given prop does not exist.
Compose the absolute "dot" path to the given key.
Marks the property as interacted.
Retrieve a prop within the current scope using "dot" notation.
Instantiate a new "scope" at the path of the given key.
Disables the interaction check.
Instantiate a new "scope" on the first child element.
Asserts that the property matches the expected value.
Asserts that the property does not match the expected value.
Asserts that all properties match their expected values.
Asserts that the property is of the expected type.
Asserts that all properties are of their expected types.
Asserts that the property contains the expected values.
Ensures that all properties are sorted the same way, recursively.
Dump the given arguments and terminate execution.
Dump the given arguments.
Asserts that all properties have been interacted with.
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Register a custom macro.
Mix another object into the class.
Checks if macro is registered.
Flush the existing macros.
Dynamically handle calls to the class.
Dynamically handle calls to the class.
Call the given Closure with this instance then return the instance.
Create a new fluent, assertable JSON data instance.
Instantiate a new "scope" on each child element.
Create a new instance from an array.
Create a new instance from an AssertableJsonString.
Get the instance as an array.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/11.x/Illuminate/Testing/Fluent/AssertableJson.html