Improving your Code with PHPUnit and Test Driven Development

Find the problem line in your plugin code, amend it, refresh the page in your WordPress test install, re-submit a form for the 937th time today, scream obscenities that you didn’t even know that you knew at the inevitable WSOD, consult debug.log, remove some failed values from the database, reset and start again.

Does this scenario sound familiar? Other than expanding your vocabulary in ways that would make your mother blush, do you want to carry on like this? Is there another way?

Yes there is, Test Driven Development. Learn how to write tests first and code second, to detect code smells through writing tests and how to test WordPress sites.

While testing won’t remove all possibility of turning the air blue, it offers a path to improved code, a controlled environment that behaves the same time every time, and at the very least, it will point you at the exact piece of code that is failing meaning that you can target your expletives accordingly.

Speaker