Let's continue the theme from the previous tip about tightening up our Laravel view assertions in our tests.
So now that you know that assertViewHas
isn't working the way you might expect with null
values, how can you find all the locations in your tests that need refactoring?
In PHPStorm, you can use Shift-Cmd-F
(or the equivalent in your OS) to "find in all files" and easily find all mentions of the assertViewHas
helper, but you might think you need to do a fancy regular expression to limit results to only those that are asserting null
values.
But there's an easier way! After doing your global Shift-Cmd-F
, you can then click in the find results and use Cmd-F
to find null
just within your existing set of search results. No fancy regex needed!
Here to help,
Joel
P.S. Laravel is pretty secure by default, but Aaron published a course to go even deeper on Laravel security.