Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Should We Test Code From Packages?

Premium
3 min read

Another sub-question to cover on the topic of "what to test": should we test something that is covered by external Laravel/PHP packages?

For example, you use a Spatie package laravel-tags to have tags in your Eloquent models. Should you write a test that the tag is inserted successfully if you do that by calling the function from that package?

That is a debatable question, but most serious package creators include tests in their packages, so package users would not need to test that or retest it manually externally.

So, for example, if we go to test folder of that package, there are quite a lot of tests asserting that if you add a tag, for example, it can create a tag, assert count, assert same, etc. So...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

54 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

No comments yet…