Welcome to ManageWP.org

Register to share, discuss and vote for the best WordPress stories every day, find new ideas and inspiration for your business and network with other members of the WordPress community. Join the #1 WordPress news community!


27 min read Ben Gillbanks
Community | tfrommen.de | Jan. 23, 2017

An Introduction to Unit Testing (for WordPress)

A detailed explanation of unit testing for WordPress, with examples for setting up tests in a variety of explanations. Plus it has Lego in the featured image! :)

An Introduction to Unit Testing (for WordPress)

Community | tfrommen.de | Jan. 23, 2017

Thorsten is a web developer since 2000, working with (and on) WordPress since 2005. Currently, Thorsten is a WordPress engineer and technical project lead at Inpsyde, Germany’s biggest WordPress agency. He is part of Inpsyde’s QA team, and leads the development of MultilingualPress, the multisite-based free open source plugin for your multilingual websites. He also maintains WP REST Starter, a Composer package for working with the WordPress REST API in an object-oriented fashion.
Thorsten is a certified PHP engineer, web development professional and tester.
If you are a software developer, you might have come across the term “testable code”. But what is it? What makes code testable, and what not?
Testable Code
Every piece of software is testable—somehow. There are several things you might be able to test:
the return value of a function;
the output of a function;
other side effects of executing a function;
whether or not a program crashes;

So, doesn’t that mean every piece of code is testable code?
It does not. That’s because almost always when someone refers to “testable code” they do it in the context of unit testing. So