Support the ongoing development of Laravel.io →
Architecture Testing

I'm new to TDD, but I've been reading a lot and understanding that code should be extremely modular and use dependancy injection to allow for full testability. (It also creates modularity, but that is another issue.) I've begun to program this way but it seems so verbose - injections everywhere to just get simple things done.

Then I came across AspectMock (https://github.com/Codeception/AspectMock) from this post (https://laracasts.com/forum/287-mocking-repository-model/0) where Jeffery Way describes it as a way to test Eloquent model, which usually require a repository class to test. He even made a video showing the difference: http://jeffrey-way.com/blog/2013/07/24/aspectmock-is-pretty-neat/.

To me, this seems like a complete game-changer in how we write out code. We don't have to use DI everywhere to achieve testability. We now only need to use it where we require modularity. Why has this idea not caught on and gained more traction?

Last updated 3 years ago.
0
Last updated 3 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

dwenaus dwenaus Joined 28 Feb 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2025 Laravel.io - All rights reserved.