Skip to main content

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? (30 h 41 min)

You also get:

55 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…

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.