Vigyata.AI
Is this your channel?
GithubGithub02

51 Adds database query count test expectation helper

This PR adds the database query count expectation helper that I used to catch N+1 issues in tests. In the video I showed how I can assert the query count for a page and then fix the code with eager loading or withCount to make the test pass.

Buy on Github

You'll be taken to Github to complete your purchase.

Pros

  • +Makes N+1 and query regressions visible in tests
  • +Encourages more performance-aware Laravel code

Cons

  • -Tests can become brittle if query counts change for valid reasons

Featured in 2 videos