beyondcode/laravel-query-detector

Question: Is that possible to test route for a N+1 problem

approached opened this issue · 1 comments

Hi@all

Is that possible to test route for a N+1 problem?

I am doing this, but you need to make a feature test. I am extending the TestCase and calling the route using $this->postJson(route($this->endpointName), $requestData);.

But make sure in your testing configuration your have the module enabled.
The query detector is injecting middleware, which is what does the job, so unit testing will not give you any information.
Also, make sure the query detector outputs to the logs, so you can see them.