O'Reilly logo

PHPUnit Essentials by Zdenek Machek

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11. Testing Legacy Code

So far, we have looked at how to write better and more testable code. It is important to get into the habit of writing tests, and it doesn't matter if you take the "test first" approach or you write code and immediately write tests for it (if not immediately, then at least on the same day). The worst thing is to slip back into the habit of believing that somehow it will work and wondering why you should waste the time writing tests. Hopefully, you've seen the advantages of writing tests, and for you, it's not a problem. However, the problem occurs when you have a project based on legacy code, and you need to keep this code running, or even extend it. Of course, it's expected that there are not going to be any bugs, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required