php-swagger-test
php-swagger-test copied to clipboard
Splitting out the request/response validation from the actual request
I'm currently using a little Laravel package I made to make this more "trait" friendly as well as interact directly with Laravel's internal call methods etc. (I hope I haven't bastardised the implementation too much :sweat_smile:)
I ended up doing quite a couple overrides which I think might be useful to actually include back here if you're keen for them.
Most notably: I made my own Requester which splits up the send
function into: send
, validateRequest
and validateResponse
I found that doing failed tests was basically impossible with the current implementation. Eg: I want to log in without parsing through an email and get a response of type 422 which exists in the OpenApi/Swagger spec.
It would always fail on the request validation and without splitting them up there was no way I could see to easily test it.
Having a validateRequestFails
method (which runs the validate with a try-catch) was suuuuuper useful
Anywhoo, this is more of a "do you want it to move in this direction?" Issue and not a bug report etc :)