TestResponse
class TestResponse
Traits
Properties
| static protected array | $macros | The registered string macros. |
from Macroable |
| protected JsonRpcResponse | $response | ||
| protected JsonRpcResponse> | $notifications |
Methods
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.
Consume a primitive's response and collect its notifications.
Assert that the response contains the given text.
Assert that the response does not contain the given text.
Assert that the response contains the given structured content.
Assert that the structured content has the expected count of items at the given key.
Assert that the expected value and type exists at the given path in the structured content.
Assert that the expected values and types exist at the given paths in the structured content.
Assert that the given path in the structured content contains all of the expected values without looking at the order.
Assert that the given paths in the structured content contain all of the expected values without looking at the order.
Assert that the structured content is exactly the given JSON.
Assert that the structured content has the similar JSON as given.
Assert that the structured content contains the given JSON fragment.
Assert that the structured content contains the given JSON fragments.
Assert that the structured content does not contain the given JSON fragment.
Assert that the structured content does not contain the exact JSON fragment.
Assert that the structured content does not contain the given path.
Assert that the structured content does not contain the given paths.
Assert that the structured content has a given JSON structure.
Assert that the structured content has the exact JSON structure.
Assert that the given key in the structured content is a JSON array.
Assert that the given key in the structured content is a JSON object.
Assert the number of notifications received.
Assert that the given notification was received.
Assert the primitive's name.
Assert the primitive's title.
Assert the primitive's description.
Assert that the response has no errors.
Assert that the primitive is not registered.
Assert that the response has no errors.
Assert that the response contains errors matching the given messages.
Assert that the current user is authenticated.
Assert that the current user is a guest.
Assert that the current user matches the given user.
Determine whether the current user is authenticated.
Assert that the response contains the expected completions.
Assert the complete set of completion values.
Assert the number of completion values.
Dump the response and end execution.
Dump the response.
Dump the response errors and end execution.
Get the primitive's textual response content.
Get the response's error messages.
Get the response's completion values.
Get the response's structured content.
Get the response's structured content for JSON assertions.
Normalize a value through its JSON representation.
Details
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 30
static void
macro(string $name, callable|object $macro)
Register a custom macro.
Macros persist in a static property for the worker lifetime and apply to every subsequent call on the macroable class.
in
Macroable at line 44
static void
mixin(object $mixin, bool $replace = true)
Mix another object into the class.
Delegates to macro() for each method; registered macros persist in a static property for the worker lifetime.
in
Macroable at line 61
static bool
hasMacro(string $name)
Check if macro is registered.
in
Macroable at line 72
static void
flushMacros()
Flush the existing macros.
Clears worker-wide macros; concurrent coroutines may resolve different methods depending on timing.
in
Macroable at line 83
static mixed
__callStatic(string $method, array $parameters)
Dynamically handle calls to the class.
in
Macroable at line 108
mixed
__call(string $method, array $parameters)
Dynamically handle calls to the class.
at line 44
__construct(Primitive $primitive, iterable|JsonRpcResponse $response, string|null $requestedUri = null)
Consume a primitive's response and collect its notifications.
at line 70
TestResponse
assertSee(array|string $text)
Assert that the response contains the given text.
at line 99
TestResponse
assertDontSee(array|string $text)
Assert that the response does not contain the given text.
at line 128
TestResponse
assertStructuredContent(Closure|array $structuredContent)
Assert that the response contains the given structured content.
at line 156
TestResponse
assertStructuredContentCount(int $count, string|null $key = null)
Assert that the structured content has the expected count of items at the given key.
at line 172
TestResponse
assertStructuredContentPath(string $path, mixed $expect)
Assert that the expected value and type exists at the given path in the structured content.
at line 200
TestResponse
assertStructuredContentPaths(array $paths)
Assert that the expected values and types exist at the given paths in the structured content.
at line 214
TestResponse
assertStructuredContentPathCanonicalizing(string $path, array $expect)
Assert that the given path in the structured content contains all of the expected values without looking at the order.
at line 226
TestResponse
assertStructuredContentPathsCanonicalizing(array $paths)
Assert that the given paths in the structured content contain all of the expected values without looking at the order.
at line 240
TestResponse
assertExactStructuredContent(array $data)
Assert that the structured content is exactly the given JSON.
at line 252
TestResponse
assertSimilarStructuredContent(array $data)
Assert that the structured content has the similar JSON as given.
at line 264
TestResponse
assertStructuredContentFragment(array $data)
Assert that the structured content contains the given JSON fragment.
at line 276
TestResponse
assertStructuredContentFragments(array $data)
Assert that the structured content contains the given JSON fragments.
at line 290
TestResponse
assertStructuredContentMissing(array $data, bool $exact = false)
Assert that the structured content does not contain the given JSON fragment.
at line 302
TestResponse
assertStructuredContentMissingExact(array $data)
Assert that the structured content does not contain the exact JSON fragment.
at line 312
TestResponse
assertStructuredContentMissingPath(string $path)
Assert that the structured content does not contain the given path.
at line 324
TestResponse
assertStructuredContentMissingPaths(array $paths)
Assert that the structured content does not contain the given paths.
at line 339
TestResponse
assertStructuredContentStructure(array|null $structure = null, array|null $responseData = null)
Assert that the structured content has a given JSON structure.
at line 352
TestResponse
assertExactStructuredContentStructure(array|null $structure = null, array|null $responseData = null)
Assert that the structured content has the exact JSON structure.
at line 362
TestResponse
assertStructuredContentIsArray(string|null $key = null)
Assert that the given key in the structured content is a JSON array.
at line 375
TestResponse
assertStructuredContentIsObject(string|null $key = null)
Assert that the given key in the structured content is a JSON object.
at line 388
TestResponse
assertNotificationCount(int $count)
Assert the number of notifications received.
at line 400
TestResponse
assertSentNotification(string $method, array|null $params = null)
Assert that the given notification was received.
at line 418
TestResponse
assertName(string $name)
Assert the primitive's name.
at line 432
TestResponse
assertTitle(string $title)
Assert the primitive's title.
at line 446
TestResponse
assertDescription(string $description)
Assert the primitive's description.
at line 460
TestResponse
assertOk()
Assert that the response has no errors.
at line 468
TestResponse
assertNotRegistered()
Assert that the primitive is not registered.
at line 488
TestResponse
assertHasNoErrors()
Assert that the response has no errors.
at line 500
TestResponse
assertHasErrors(array $messages = [])
Assert that the response contains errors matching the given messages.
at line 522
TestResponse
assertAuthenticated(string|null $guard = null)
Assert that the current user is authenticated.
at line 532
TestResponse
assertGuest(string|null $guard = null)
Assert that the current user is a guest.
at line 542
TestResponse
assertAuthenticatedAs(Authenticatable $user, string|null $guard = null)
Assert that the current user matches the given user.
at line 566
protected bool
isAuthenticated(string|null $guard = null)
Determine whether the current user is authenticated.
at line 576
TestResponse
assertHasCompletions(array $expectedValues = [])
Assert that the response contains the expected completions.
at line 596
TestResponse
assertCompletionValues(array $values)
Assert the complete set of completion values.
at line 610
TestResponse
assertCompletionCount(int $count)
Assert the number of completion values.
at line 626
void
dd()
Dump the response and end execution.
at line 634
TestResponse
dump()
Dump the response.
at line 644
void
ddErrors()
Dump the response errors and end execution.
at line 654
protected array
content()
Get the primitive's textual response content.
at line 673
protected array
errors()
Get the response's error messages.
at line 693
protected array
completionValues()
Get the response's completion values.
at line 710
protected array|null
structuredContent()
Get the response's structured content.
at line 727
protected AssertableJsonString
assertableStructuredContent()
Get the response's structured content for JSON assertions.
at line 743
protected mixed
toJsonRepresentation(mixed $value)
Normalize a value through its JSON representation.