WP Plugin Tests: planning the course

For personal reasons I don’t tend to publish my year in review or new year goals posts any more. As I start the year, something that I’ve had on my mind since forever was the idea of recording a development related course of some kind.

Here are some of the reasons I want to put some time into building some courses in 2020.

  • I like sharing knowledge with others.
  • I enjoy the process of building content around specific topics.
  • I like to look at areas that are niche/not popular, but necessary, and build content around them.
  • I’d like to find a way to monetize that somehow, to cover the time spent.
  • I find I also learn more about the thing I’m presenting.

At the end of last year I asked some folks online which subjects they felt were missing from the world of WordPress plugin development courses. After gathering the ideas, I started this year by asking my Twitter timeline to vote on what the first course should be.

The winner was Automated testing for your WordPress plugin, which to be honest was a) the course I wanted to create first any way and b) the one I think the world of WordPress plugin development needs the most right now. So here we are.

Planning

I’ve started sketching out the basic outline of what I think the course should contain, and I’m posting it here to gather some feedback. As I think about it some more, and start putting the course-ware together, I’m sure I’ll add to this list, but I want to get some community feedback, in case I miss anything.

If you’re interested in learning about writing tests for your WordPress plugin, please feel free to comment on what I’ve already included, what you would like to see, or anything else you feel should be included.

If you’d like to keep updated about the course and it’s development, or when it launches, please enter your email and hit subscribe below.

[et_bloom_inline optin_id=”optin_1″]

WordPress Plugin Automated Testing course notes:

The project – the example plugin we’ll be using to write tests for

  • MailChimp sign up form
  • Posts to MailChimp API
  • Form shortcode

Tools – the tools we’ll be learning about

  • PHUnit
    • WordPress recommended version vs latest stable version
  • WP CLI
  • WordPress Plugin scaffolding

Setup

  • Installing the tools
  • Phpunit.xml config file
  • Command line vs IDE setup

Writing your first test

  • The “adding tests to a legacy codebase” conundrum

Testing

  • Action and filter hooks
  • Testing your methods/functions
  • Testing against the database

Mocking

  • Does the built in WordPress unit tests allow for mocks?
  • Mocking sending an email
  • Mocking an API request 

CodeCeption

  • Setup
  • Unit Tests with CodeCeption
  • Writing your first feature test

Posted

in

by

Tags:

Comments

2 responses to “WP Plugin Tests: planning the course”

  1. Aladdin Avatar
    Aladdin

    Hi Jonathan,

    I can’t wait to go through this course. I have been reading about automated tests for 2 months now and I was wondering how it can be implemented the WordPress way.
    One of the things that bugged me the most is how to automate a test for an add-on plugin which of course depends on another plugin for input and output.

    Thank you for this and Godspeed 🙂

    1. Jonathan Avatar
      Jonathan

      Thanks mate, I’ll make a note of your suggestion.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.