Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

FrazeColder's avatar

Do I have to write tests for my Laravel Nova code?

Hi Guys,

I am using Laravel Nova to administrate my users, posts, comments, etc. So, basically I coded a CMS for myself using Laravel Nova as my admin dashboard.

All the code I have written is PHPUnit tested except the code under app/Nova which is the code for the Nova dashboard. Now I wonder if I should write PHPUnit tests as well for this code as Laravel Nova comes as a tested package.

I am using the functions Nova is providing and some other functions/fields other packages for Nova are providing.

What do you say? I kind of see the point "you should test if the actions really do what you want" but also I think Laravel is a simple CRUD package which comes as a tested package. Means, If I set the database fields correct, everything should work like a charm without testing it.

What do you think?

Kind regards and thank you!

0 likes
1 reply
gitwithravish's avatar

Well, just because its a package, doesn't mean it would flawless. Yes the probability so less for something breaking down, but there still could be. So I would write tests if its feasible.

Check out this repo. It shows how the test took place. https://github.com/bradenkeith/testing-nova

There are already a lot more packages for nova testing and discussions over different platforms, you should check them out too, if you haven't. (:

Please or to participate in this conversation.