Support the ongoing development of →
posted 9 years ago
Last updated 2 years ago.

I found Jeffrey Ways Testing decoded to be really helpful.

As far as your questions regarding testing eloquent models if you are coming from a TDD approach its good to think of your tests as the specs or description of all functionality your class has. Eloquent does so much and if you try to test it all you'll get stuck writing tests for hours. Just test what your going to use. So if you are going to use a relation in your model that says that a Manufacturer has many Models test for that but only once you are going to need it. TDD helps to prevent excessive code that never gets used.

Last updated 2 years ago.

I highly recommend the book as well. Well worth the money you pay for it. As mentioned in the book, since Eloquent is already united tested by the framework, you don't need to write tests for it. However, if you are creating additional methods inside of your models, you will need to write tests for those.

Even though you may not have a UI for your application yet, you can still begin to use TDD approach to create some controllers that will handle the logic.

Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?

chimmel chimmel Joined 4 Aug 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.