AssertableInertia
class AssertableInertia extends AssertableJson
Traits
Properties
| protected array | $interacted | The list of interacted properties. |
from Interaction |
| static protected array | $macros | The registered string macros. |
from Macroable |
Methods
Assert that the prop is of the expected size.
Assert that the prop size is between a given minimum and maximum.
Ensure that the given prop exists.
Retrieve a prop within the current scope using "dot" notation.
Assert that the property matches the expected value.
Assert that the property does not match the expected value.
Assert that the property is of the expected type.
Assert that all properties are of their expected types.
Assert that the property contains the expected values.
Ensure that all properties are sorted the same way, recursively.
Apply the callback if the given "value" is (or resolves to) truthy.
Apply the callback if the given "value" is (or resolves to) falsy.
Mix another object into the class.
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.
Create a new instance from an array.
Create a new instance from an AssertableJsonString.
Convert the instance to an array.
Assert that the page uses the given component.
Assert that the current page URL matches the expected value.
Assert that the current asset version matches the expected value.
Load the deferred props for the given groups and perform assertions on the response.
Reload the Inertia page as a partial request with only the specified props.
Reload the Inertia page as a partial request excluding the specified props.
Assert that the Flash Data contains the given key, optionally with the expected value.
Assert that the Flash Data does not contain the given key.
Assert that the given flash data array contains the given key, optionally with the expected value.
Assert that the given flash data array does not contain the given key.
Details
in
Has at line 16
Has
count(string|int $key, int|null $length = null)
Assert that the prop is of the expected size.
in
Has at line 44
Has
countBetween(int|string $min, int|string $max)
Assert that the prop size is between a given minimum and maximum.
in
Matching at line 240
abstract Matching
has(string|int $key, int|Closure|null $value = null, Closure|null $scope = null)
Ensure that the given prop exists.
in
Has at line 132
Has
hasAny(array|string $key)
Assert that at least one of the given props exists.
in
Matching at line 235
abstract protected string
dotPath(string $key = '')
Compose the absolute "dot" path to the given key.
in
Interaction at line 20
protected void
interactsWith(string|int $key)
Mark the property as interacted.
in
Interaction at line 56
abstract protected mixed
prop(string|null $key = null)
Retrieve a prop within the current scope using "dot" notation.
in
Has at line 193
abstract protected Has
scope(string|int $key, Closure $callback)
Instantiate a new "scope" at the path of the given key.
in
Interaction at line 46
Interaction
etc()
Disable the interaction check.
in
Has at line 203
abstract Has
first(Closure $callback)
Instantiate a new "scope" on the first element.
in
Matching at line 19
Matching
where(string $key, mixed $expected)
Assert that the property matches the expected value.
in
Matching at line 53
Matching
whereNot(string $key, mixed $expected)
Assert that the property does not match the expected value.
in
Matching at line 132
Matching
whereAll(array $bindings)
Assert that all properties match their expected values.
in
Matching at line 144
Matching
whereType(string $key, array|string $expected)
Assert that the property is of the expected type.
in
Matching at line 166
Matching
whereAllType(array $bindings)
Assert that all properties are of their expected types.
in
Matching at line 178
Matching
whereContains(string $key, mixed $expected)
Assert that the property contains the expected values.
in
Matching at line 219
protected void
ensureSorted(mixed $value)
Ensure that all properties are sorted the same way, recursively.
in
Dumpable at line 12
never
dd(mixed ...$args)
Dump the given arguments and terminate execution.
in
Interaction at line 32
void
interacted()
Assert that all properties have been interacted with.
in
Conditionable at line 23
mixed
when(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) truthy.
in
Conditionable at line 56
mixed
unless(mixed $value = null, callable|null $callback = null, callable|null $default = null)
Apply the callback if the given "value" is (or resolves to) falsy.
in
Macroable at line 28
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Boot-only. Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 41
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Boot-only. Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 57
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 68
static void
flushMacros()
Flush the existing macros.
Boot or tests only. Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 78
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 103
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
in
Tappable at line 15
mixed
tap(callable|null $callback = null)
Call the given Closure with this instance then return the instance.
in
AssertableJson at line 39
protected
__construct(array $props, string|null $path = null)
Create a new fluent, assertable JSON data instance.
in
AssertableJson at line 108
AssertableJson
each(Closure $callback)
Instantiate a new "scope" on each child element.
in
AssertableJson at line 133
static AssertableJson
fromArray(array $data)
Create a new instance from an array.
in
AssertableJson at line 141
static AssertableJson
fromAssertableJsonString(AssertableJsonString $json)
Create a new instance from an AssertableJsonString.
at line 282
array
toArray()
Convert the instance to an array.
in
AssertableJson at line 157
static void
flushState()
Flush all static state.
at line 62
static AssertableInertia
fromTestResponse(TestResponse $response)
Create an AssertableInertia instance from a test response.
at line 94
AssertableInertia
component(string|null $value = null, null|bool $shouldExist = null)
Assert that the page uses the given component.
at line 112
AssertableInertia
url(string $value)
Assert that the current page URL matches the expected value.
at line 122
AssertableInertia
version(string $value)
Assert that the current asset version matches the expected value.
at line 134
AssertableInertia
loadDeferredProps(Closure|array|string $groupsOrCallback, Closure|null $callback = null)
Load the deferred props for the given groups and perform assertions on the response.
at line 153
AssertableInertia
reload(Closure|null $callback = null, array|string|null $only = null, array|string|null $except = null)
Reload the Inertia page and perform assertions on the response.
at line 190
AssertableInertia
reloadOnly(array|string $only, Closure|null $callback = null)
Reload the Inertia page as a partial request with only the specified props.
at line 208
AssertableInertia
reloadExcept(array|string $except, Closure|null $callback = null)
Reload the Inertia page as a partial request excluding the specified props.
at line 224
AssertableInertia
hasFlash(string $key, mixed $expected = null)
Assert that the Flash Data contains the given key, optionally with the expected value.
at line 236
AssertableInertia
missingFlash(string $key)
Assert that the Flash Data does not contain the given key.
at line 248
static void
assertFlashHas(array $flash, string $key, mixed $expected = null)
Assert that the given flash data array contains the given key, optionally with the expected value.
at line 269
static void
assertFlashMissing(array $flash, string $key)
Assert that the given flash data array does not contain the given key.