This repository supports two local verification lanes:
- JavaScript/editor workflows through the
npm run env:*,npm run build, andnpm run test:js*scripts. - PHP integration workflows through
composer test:ut,composer test, andcomposer test:coverage.
- Composer v2
- Node v20 (
.nvmrc) - Docker, if you want to use a container-backed local database
- A MySQL client on
PATHforwp db reset,wp db check, and related Composer scripts
On macOS with Homebrew, the client install is:
brew install mysql-client
export PATH="/opt/homebrew/opt/mysql-client/bin:$PATH"The PHP test suite reads database credentials from the ignored file tests/.env.
Do not commit that file.
Generate it with:
./tools/bootstrap-test-env.shThe bootstrap script uses this precedence:
- Explicit
WP_TESTS_DB_*environment variables - Auto-detection of a single running Docker
mysqlormariadbcontainer with a published3306/tcpport - Fallback defaults from
tests/.env.dist
Use --force to overwrite an existing local file:
./tools/bootstrap-test-env.sh --forceIf you want to point the suite at a non-Docker database, export the variables first:
WP_TESTS_DB_NAME=wordpress_test \
WP_TESTS_DB_USER=root \
WP_TESTS_DB_PASS=secret \
WP_TESTS_DB_HOST=127.0.0.1:3306 \
./tools/bootstrap-test-env.sh --forceInstall dependencies:
composer install
npm install --legacy-peer-depsIf you use the repo's wp-env scripts, start them first:
npm run env:startThen bootstrap the PHP test database config:
./tools/bootstrap-test-env.shRun the main gates:
composer test
composer analyse:psalm
npm run lint
npm run test:js -- --ci
npm run buildRun coverage gates when you change thresholds or need an updated metrics snapshot:
composer test:coverage
npm run test:js:coverage- The bootstrap script writes only
tests/.env, which is already ignored by Git. - Local PHP 8.5 may emit deprecation noise from upstream WordPress and WP-CLI dependencies even when the repo gates pass.
- The committed test scripts assume
wpcan call local MySQL client tools successfully. Ifwp db resetfails withenv: mysql: No such file or directory, fix yourPATHfirst.