-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Env: wp-phpunit not in sync with mapped WordPress version #23171
Comments
I'm using a source dependency of wordpress-develop in my project and I'd like to use this Install with the Docker test environment to run PHP Unit. Based on that Slack documentation it seems like this might not be possible OOTB currently. Is that correct? |
Hm. I'm not exactly sure how to do that, but really the only thing that wp-phpunit does is make the WordPress tests library available inside of docker. you currently need to write most everything else yourself (like the config file and bootstrap file). So if your wordpress source includes the tests library, then I think it's just a matter of loading the tests lib from the right location. |
What I'd like to see is have PHPUnit available inside the wp-env test Docker container. |
Why not use the gutenberg/packages/env/lib/build-docker-compose-config.js Lines 168 to 179 in a94a95b
Or at least, what is that missing for you? It should pick up on any sources or configuration mapped to the tests volume, and I think it would use the same database |
@noahtallen now that I'm looking through that build script for Docker and seeing how it's used in Gutenberg as well I have a better clue how to make use of the phpunit container. Thanks! |
Describe the bug
A few days ago, we noticed phpunit failures in Travis. This was because a change was merged to wordpress core which was propagated to wp-env. Unfortunately, wp-phpunit (the dep we use to install wp phpunit test lib) is pinned at the test code in the last WP version, so the same changes did not propogate to it.
Essentially, the WordPress version running on the wp-env container is not in sync with the version the wp-phpunit test lib expects.
Link to discussion in make WordPress slack (requires signup): https://wordpress.slack.com/archives/C02QB2JS7/p1591979580086000
Solution
The solution we have discussed (cc @TimothyBJacobs, @joemcgill) is to do something like this:
svn
which contains the test-lib in sync with the current WP source code. (We can use wp-cli as a basis for this code.)tests/phpunit/includes
andtests/phpunit/data
(either inside the docker image or in~/.wp-env/$hash/
)One benefit of this approach is that no one will have to worry about installing a wp-phpunit dep, which makes phpunit much more accessable in wp-env.
The text was updated successfully, but these errors were encountered: