Chapter 7. Write Tests

At this point, our legacy application has been partially modernized so that we have all existing classes in a central location. Those classes now enjoy freedom from global and new using dependency injection. The proper thing to do now is to write tests for these classes so that, if we ever need to change them, we know that their pre-existing behavior remains intact.

Fighting test resistance

We are probably not eager to spend time writing tests right now. We don't want to lose the forward momentum we are feeling. Just as we believe we are making some real progress, stopping to write tests feels like make-work. It takes away from the joy of making yet another series of improvements to the awful codebase that we have been suffering ...

Get Modernizing Legacy Applications in PHP now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.