LoneStarPHP - Using Dependency Injection for Proper Unit Testing

If you're not unit testing, you should be. This topic will cover manual dependency injection, why it's essential for unit testing, and how to use it with your code. It will cover both writing unit tested code from scratch and taking an existing class and refactoring it with unit tests and dependency injection. I'll start off with some code I've written and how I built it with tests, show where other objects are injected and why. Then I'll pull up an old dirty class and refactor it live with DI.