Wire PHPUnit suites into CI with a real WordPress test environment - #7
Merged
Merged
Conversation
Adds a MySQL service to the CI matrix and a "Run PHPUnit" step that installs the shared WP test suite + WPGraphQL and runs all 3 sub-plugins' suites, instead of stopping at PHPCS/PHPStan/build as before. New Makefile targets (install-wp-test-env, phpunit, test-integration) reuse the exit-code-propagation pattern already established for phpcs/phpstan/install/build. Fixed two bugs surfaced while wiring this up locally: an unquoted $(DB_PASS) in the installer call silently shifted every positional argument when the password was empty, and install-wpgraphql-for-tests.sh's reinstall prompt hit EOF and killed the script under set -e whenever stdin had no TTY and no CI flag was set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
install-wp-test-env,phpunit, andtest-integrationMakefile targets, reusing the exit-code-propagation pattern already established forphpcs/phpstan/install/build(Fix silently-swallowed CI failures + resolve pre-existing PHPStan errors #4).$(DB_PASS)in the Makefile's installer call silently shifted every positional argument toinstall-wp-tests.shwhenever the password was empty.install-wpgraphql-for-tests.sh's reinstall prompt (read -p ...) hit EOF and killed the script underset -ewhenever stdin had no TTY and no CI flag (FORCE_GRAPHQL_REINSTALL/CI/GITHUB_ACTIONS/CONTINUOUS_INTEGRATION) was set — e.g. every localmake install-wp-test-envre-run.Changes Made
.github/workflows/ci.yml: MySQL service,subversion/mysqli/pdo_mysqldeps, new "Run PHPUnit" step.Makefile: new DB_*/WP_VERSION variables, exported fixedWP_TESTS_DIR/WP_CORE_DIRdefaults (not$TMPDIR-derived, so all 3 sub-plugins' test scripts agree across platforms), 3 new targets.scripts/install-wpgraphql-for-tests.sh: TTY-guarded reinstall prompt.README.md,CONTRIBUTING.md: updated testing instructions.Testing
make test-integration DB_PASS=''runs install-dev → WP test suite install → WPGraphQL install → PHPUnit for all 3 sub-plugins — all 148 tests pass.core-reviewpass (--budget medium) before opening this PR; found and fixed 2 stale-doc findings (README/CONTRIBUTING referencing the old manual commands), re-reviewed to confirm convergence.Checklist