In this article, Brett Schuchert discusses how modern mocking tools affects positively our ability to work with legacy code and the possible negative implications of using mocking tools. These tools allow us to perform unit testing without actually changing the underlying code. He starts with a discussion about the challenges of unit testing and how mocking tools help to solve them; at least on the surface.
This just might be the thing that brings a mathematical rigor to Test Driven Development (TDD). If nothing else, it will certainly help programmers choose which tests to write next, and how best to make them pass. Transformations are like refactorings in that they are simple incremental changes to code.
This article proposes strategies to refactor problematic PHP code, making it easier to test it with unit testing tools, while reducing dependencies that improves your code base.
“Bug fixing often uncovers opportunities for refactoring. The very fact that you’re working with code that contains a bug indicates that there is a chance that it could be clearer or better structured.”