I\'m trying to wrap my head around dependency injection and the IoC container and i\'m using my UserController as an example. I\'m defining what the UserController depends o
If you're worried about a testability thing then you should really only be injecting instances that aren't being routed through a facade, as the facades themselves are testable already (meaning you can mock these in L4). You shouldn't need to inject the response, hasher, view environment, request, etc. By the looks of it you only need to be injecting the $user
.
For everything else I'd just stick to using the static facade. Check out the swap
and shouldReceive
methods on the base Facade class. You can easily swap out the underlying instance with your own mocked object or simply start mocking with, for example, View::shouldReceive()
.
Hope this helps.