From the course: PHP: Testing Legacy Applications
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
How the tools change
- [Instructor] Previously, I talked about how the test after approach that is required for legacy code differs from the test first approach that can be adopted for projects that start with testing from the very beginning. To be perfectly clear, you'll still be making use of assertions and test doubles, but you are likely going to be using a lot more test doubles than you will end up being comfortable with. I know you might not know what a test double is. Don't worry, I'm going to explain them in detail later. When we think about code that is easy to test, it has lots of the same properties, objects with lots of small methods, and we basically pass messages around that are processed and reacted to. In an environment like this, we can write code to greatly reduce the number of dependencies we need to create substitutes for. This, in turn, leads us to needing fewer and fewer test doubles. But legacy codebases are generally not that ready for the isolated unit tests that can help protect…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.