An approach to testing middleware
Laravel rockstar TJ Miller posted a short and sweet post how how he tested a middleware that forces requests to respond with JSON.
So what I’ve done here is define custom testing routes and applied the middleware as I would use it in the application routes, in this case global middleware and as middleware for the api group. This allows me to assert that the middleware is configured and functioning correctly.
https://medium.com/@sixlive/an-approach-to-testing-middleware-c547fc942848
What are your thoughts on "An approach to testing middleware"?