Daniel Convissor: Unit Testing WordPress Plugins with PHPUnit

Continue the discussion

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Published

November 19, 2014

Trust me, maintaining software is sooo much easier when you have unit tests to let you know when changes meet their goals or introduce new bugs. PHPUnit is the standard suite for testing and analyzing PHP code. But getting PHPUnit working with a WordPress plugin is challenging. This presentation explains the unit tests created for the Login Security Solution plugin. How to mediate the conflict between WordPress’ heavy reliance on globally scoped variables (groan) and PHPUnit’s squashing of global variables
How to test calls to wp_mail(), wp_logout(), wp_redirect()
How to continue execution after PHP produces expected errors
Verifying database inserts that have auto-increment ID’s

Rate this:

Event

WordCamp NYC 2014 58

Speakers

Daniel Convissor 1

Tags

unit testing 27

Language

English 9701

Download
MP4: Low, Med, High, Original
OGG: Low
Subtitles
Subtitle this video →
%d bloggers like this: