Testing¶
Tests run on PHPUnit 9 inside subscribed/wp-testing-kit: a Docker environment with MariaDB, WordPress (test library) and WooCommerce. No local WordPress checkout is needed.
Running¶
composer install
composer test # whole suite
composer test -- --filter OrderLookupService # a subset (kit >= 1.0.2 forwards arguments)
Settings live in .env.testing (PHP version, WordPress version, WC_LOAD/WC_INSTALL, BOOTSTRAP_EXTRA). tests/integration-setup.php sets the dummy Dixa MIM Tools credentials and shims Bedrock's env().
composer test:init recreates .env.testing from the kit template; composer test:reset wipes the Docker volumes.
Writing tests¶
- WordPress-dependent tests extend
WP_UnitTestCase; pure ones extendPHPUnit\Framework\TestCase. - Mirror the
src/path undertests/.