Carl Alexander is a PHP developer that loves teaching advanced technology topics. Besides helping with WordCamp Montreal, he organizes the other WordPress events during the rest of the year. His other interests lie with nutrition and sports science, weight training and, most importantly, video games.
Presentation: Introduction to WordPress Unit Testing
“I’ve doing various types (Unit, Functional, Behavioural) of PHP testing for a few years. While WordPress has had a unit testing library for a few year, it had a big flaw from a test design perspective. It was near impossible to create unit tests in proper isolation.
Recently, I was able to work around that problem. solving the problem meant that you could now create tests without loading WordPress. This makes testing easier and more accessible to beginners.
That’s what motivated me to submit the talk.”
What unique perspective are you bringing to this talk?
“Until recently, it was impossible to mock WordPress functions. You had to load WordPress with a database to test your code. You couldn’t test that your code was calling WordPress functions with the right values.
This will all change with this talk! I’ll show how you can mock WordPress functions like get_option. You’ll be able to check if your code passes the correct values to WordPress. All that without loading WordPress at all!”
What’s one really cool thing people will discover during your session?
“Unit testing has always had a bad rap like doing exercise (Ugh… Who does that!). But like exercise, there’s a lot of benefits to unit testing. You might not outrun zombies (the World War Z kind), but it’ll make you a better coder for sure.
That’s because code that’s easy to test is code that’s better written. It also lets you code with more freedom. You can go all Dr. Frankenstein on your code (It’s alive!) and still know if your code will work.
You’ll see all that and more during the talk.”
What are you most looking forward to at WordCamp Toronto?
“I’m looking forward to catching up with the WordPress crowd from Toronto. There’s a lot of close friendships between all the east coast Canadian WordPress groups. It’ll be fun to see everyone since WordCamp Montréal! “