Directory

Tests: use tests-wordpress wp-env for phpunit by vcanales · Pull Request #618 · WordPress/create-block-theme · GitHub
Skip to content
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

Tests: use tests-wordpress wp-env for phpunit #618

Merged
merged 1 commit into from
May 9, 2024

Conversation

vcanales
Copy link
Member

@vcanales vcanales commented May 6, 2024

Running tests on the cli environment causes conflicts with the dev environment; the tests will log you out, modify the theme, etc.

Running tests on tests-wordpress will allow you to run tests along with the dev environment without interference.

Testing:

  1. Run npm run wp-env start to start a WordPress environment.
  2. Log into the dev environment and see that everything is working normally.
  3. Running npm run test:php will work as before, and will not mess with the dev environment.
    Before applying this branch, running npm run test:php would log you out and activate an invalid theme on your dev environment.

Running tests on the `cli` environment causes coflicts with the `dev`
environment; the tests will log you out, modify the theme, etc.

Running tests on `tests-wordpress` will allow you to run tests along
with the `dev` environment without interference.
Copy link
Contributor

@matiasbenedetto matiasbenedetto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could reproduce this on trunk:

running npm run test:php would log you out and activate an invalid theme on your dev environment.

This branch doesn't affect the main container but breaks WordPress in the tests container, as it used to in the main dev container. I think that's unexpected and probably caused by problematic test cases we should fix.

Still, this change mitigates the problem so, I'm approving the PR, but doesn't solve it.
I think the follow-up of this PR is fixing the tests that break the WordPress instance in the tests container.

@pbking pbking merged commit ddc91e2 into trunk May 9, 2024
2 checks passed
@pbking pbking deleted the fix/use-tests-wordpress-environment-for-phpunit branch May 9, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants