PHPUnit/Codeception + Plugin with custom tables & constants
-
I’m trying to set up unit+integration testing for my plugin, and I’ve followed the instructions on the wordpress site, https://make.www.ads-software.com/cli/handbook/misc/plugin-unit-tests as well as many other tutorials that either use PHPUnit or Codeception+wp-browser (which uses PHPUnit under the hood) in order to start testing the plugin’s functions etc.
My plugin uses custom tables, which are installed upon plugin activation if they aren’t present, and also some custom constants located in wp-config.php
The general testing setup creates a new database/install for running the tests, however it also appears that the plugin is pre-activated, so the activation scripts never run and the tables aren’t installed. Also it doesn’t include any of the custom constants. Because of this obviously fatal errors get triggered.
Is there a way to run activation scripts right after the test database gets installed, in order to ensure the tables are there? Also how can I include the custom constants (likely with testing values) when using PHPUnit?
thanks!
- The topic ‘PHPUnit/Codeception + Plugin with custom tables & constants’ is closed to new replies.