ResoundingEchoes

The Volume Just Increases

  • Facebook
  • GitHub
  • LinkedIn
  • Twitter
  • YouTube
  • Home
  • Portfolio
  • Blog
  • Interact
    • Say Hello
    • Request A Quote
    • Join Our Newsletter
You are here: Home / Development / Unit Testing With PHPUnit

Unit Testing With PHPUnit

March 1, 2017 by Michael Hull Leave a Comment

Merging code, especially when authored by multiple people, can lend itself to a lot of risk.

As a code base grows, there may be an underlying feeling that more bugs exist than we can find by digging through our code editor or our application’s various screens.

Tangled mess of wires and switches

Unit testing is a process that lets us test the individual components of our software application in an automated fashion.  When we author unit tests we may be codifying decisions we have made, verifying the integrity of our expected inputs/outputs, or simply checking that our objects have certain properties after being constructed.  In any case, writing tests can save us a lot of time because it takes away the need to manually verify that our code is working as expected.

This post is a work-in-progress, but our goal is to demonstrate the steps for installing and using the PHPUnit software on both Windows and Mac systems, with the goal of implementing unit testing in PHP applications.

We will start off by discussing unit testing in an abstract sense, but we will also take a look at how we can setup unit tests within the WordPress environment using WP-CLI.

Software

PHPUnit
WP-CLI

Windows Software

Git Bash
XAMPP

Mac Software

MAMP

Resources

Getting started with PHPUnit
Pippin Williamson’s series on Unit Tests For WordPress Plugins
Make WordPress Blog post on Plugin Unit Tests
WP-CLI documentation for the scaffolding plugin tests
PHPUnit assertions
Presentations on PHPUnit

Filed Under: Development Tagged With: PHP, PHPUnit, WP-CLI

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

How can we help you?   »

Recent Posts

  • Creating An xy-Plane Component With Vue.js
  • Set Theory And Russell’s Paradox
  • Function And Set Notation
  • What Is A Function
  • My First Peek At Angular 2

© 2025 ResoundingEchoes