jasonmccreary / laravel-test-assertions

A set of helpful assertions when testing Laravel applications.
321 stars 34 forks source link

Allow to Use FormRequest Interface on assertActionUsesFormRequest #24

Closed yurikoster1 closed 2 years ago

yurikoster1 commented 4 years ago

Allows the assertion assertActionUsesFormRequest to pass when the action in the controller uses an Interface instead of a concrete method

jasonmccreary commented 3 years ago

@yurikoster1, curious when you would use an interface for a form request. Unless it were bound to a concrete form request, the validation would not work.

yurikoster1 commented 3 years ago

I use it when versioning an API by extending the controller class from the previous version, using an interface allows me to have a different form request bound to the same method on both versions of the controller. Then on the constructor of both controllers I bind the interface to the correct concrete class.