-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
WP_Env: tests-cli phpunit executable file not found in $PATH: unknown #51686
Comments
Hi, |
Just ran into this same issue. Using the latest package (8.5.0). |
Confirmed on version 8.7.0. |
Same here. If I manually exec into the container (any of these: "mysql", "tests-mysql", "wordpress", "tests-wordpress", "cli", "tests-cli"), and I run
So it looks like the phpunit executable is just not there at all. |
As an alternative, if your project uses composer to install packages (mine does, only dev dependencies), you can install phpunit locally and use it this way. Before:
PHPUnit installed locally (indirectly via
then
Please note that I used PHPUnit Polyfills version 1. When trying this with version 2, I got plenty of exceptions and it didn't work (but that's another issue).
|
Here's what I found while investigating. In the container:
Additionally:
The issue:
@dawidurbanski's solution works and is what I am doing in my own projects as well. You can also change the path in their solution like so to use the globally installed version in the meantime:
Ultimately the global composer bin directory should be added to the |
Ah! This could explain why installing yoast/phpunit-polyfills:"^2.0" causes an issue. It's just a conflict between these two probably. |
What's interesting is that if I
I actually missed this line where it is actually added to $PATH before the phpunit-polyfills package is installed. gutenberg/packages/env/lib/init-config.js Line 251 in 069a8f8
|
Interesting. Now I checked, if I do (I have wp-env installed in the project):
Hmmmm.... |
There's different version returned if I use it when running from the inside of the container, and different when using directly as a command in the wp-env. Also:
But:
|
8.7.0 is actually the version of
|
This might be issue with the shell version. This works when using I assume running wp-env command tries to run this with default shell. See this:
|
Possible culprit: gutenberg/packages/env/lib/init-config.js Lines 175 to 176 in 069a8f8
|
PR up. It ended up being a difference in how Putting |
@JUVOJustin, while we're awaiting approval/merge for the solution addressing the unavailability of global PHPUnit in #54508, you can implement the interim solution outlined here: #42286 (comment) |
Description
I want to run my phpunit tests within wp-env tests-cli container as it is suggested in the documentation. However, when running
wp-env run tests-cli wp-env run tests-cli --env-cwd=wp-content/plugins/juvo-session-manager phpunit
i get the following error message:Same command with composer does work. Also, when starting bash inside the container, i see that phpunit is generally available.
Step-by-step reproduction instructions
npm run wp-env start
wp-env run tests-cli --env-cwd=wp-content/plugins/juvo-session-manager phpunit
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: