Yes and no.
Using the construct 'use' only aliases a class to work in the current class. This has nothing to do with how it is used. It might be aliased to shorten type hinting or it might be extended. Neither of which are dependencies. If a class is used within an object itself then it is a dependency.
Any Laravel facade used is essentially a dependency. It just hasn't been injected through the controller. Its just a nicer syntax than injecting through the controller, however I find it harder to see the purpose of the class when not using dependency injection.
I would agree. Its the ease mostly when using facades. Since all laravel facades are mockable by implementation , will it implicate the ability to unit test my code.
Ref : Illuminate\Support\Facades\Facade class
Ref : http://laravel.com/docs/testing#mocking-facades
damienadermann said:
Yes and no.
Using the construct 'use' only aliases a class to work in the current class. This has nothing to do with how it is used. It might be aliased to shorten type hinting or it might be extended. Neither of which are dependencies. If a class is used within an object itself then it is a dependency. Wt just hasn't been injected through the controller. Its just a nicer syntax than injecting through the controller, however I find it harder to see the purpose of the class when not using dependency injection.
gayanhewa said: will it implicate the ability to unit test my code.
No it won't. It will just be tested slightly differently.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community