Over the course of WordPress’s existence, PHP has evolved into a first-class language. Unfortunately, left-overs like the global namespace make it all too easy to write code that’s hard to test. I’d like to take you on a tour through writing a WordPress plugin in a way that makes testing easy. Using features like generators, dependency injection, spies, and stubs, you can write tests which rock and produce better code while you’re at it!