Unit testing wordpress plugins with plugin options

As the testing database is (usually, and should be) a separate database, you will need to set the appropriate option value in the setUp routine (using add_option or update_option).

I would also recommend deleting or reseting the option in the teardown method as well, but I have had issues when trying to drop tables (see Plugin development with unit tests).

Leave a Comment