Appearance
Testing
The plugin ships an integration test suite that runs against a real WordPress + WooCommerce stack — no mocks. It exercises the genuine order CRUD paths: creating orders, editing items through wc_save_order_items(), applying coupons, creating refunds, and reading back the resulting notes.
Running with wp-env
Requires Docker and Node:
bash
composer install
npm install
npm run env:start
npm testwp-env boots a fresh WordPress with the latest stable WooCommerce and the plugin active, then npm test runs PHPUnit inside the tests container. npm run env:stop stops the containers; npm run env:destroy removes them entirely.
Because the environment is a clean install with WooCommerce's defaults, the suite runs against High-Performance Order Storage — which is also where the trickiest behavior lives (HPOS reports address changes under both nested and flat keys; the plugin dedupes them, and a test locks that in).
Running against an existing install
The bootstrap is environment-agnostic. Point it at any WordPress install with WooCommerce active:
bash
WP_LOAD_PATH=/path/to/wordpress/wp-load.php vendor/bin/phpunitUnset, WP_LOAD_PATH defaults to the install the plugin directory sits inside. Two safety measures apply:
- The suite refuses to run unless the database name contains
test(override withWP_TESTS_ALLOW_ANY_DB=1). PHPUNIT_TEST_MODEis defined before WordPress loads, so awp-config.phpcan switch to a dedicated test database when the constant is present.PHPUNIT_LOCAL_HOSTis defined too when theDOCKER_ENVIRONMENTenv var is absent, for configs that need different database hosts inside and outside containers.
Tests match on specific note text rather than exact note counts, so they tolerate other active plugins writing their own notes in shared environments.
Continuous integration
Every push runs the wp-env suite in GitHub Actions across a PHP version matrix (see .github/workflows/tests.yml). The workflow installs Composer and npm dependencies, starts wp-env with WP_ENV_PHP_VERSION set from the matrix, and runs the same npm test used locally.