Open josephkerkhof opened 1 week ago
$response = get('route')->assertOk();
$json = $response->json();
# some code to determine that the response json is tied to LaravelData
Correct me if I'm wrong, but response JSON always resolves to array (in PHP), so you can't really tell what object they inherited from.
If you're testing the method directly, then toBeInstanceOf
could help you with determining the inheritance of returned object.
I would love to use Pest's architecture test framework to perform assertions on what methods return.
My personal use case is to assert that my project's Http controller public methods (invokable or otherwise) return objects that inherit from LaravelData.