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

Simplify PHPUnit setup #520

Draft
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Draft

Simplify PHPUnit setup #520

wants to merge 4 commits into from

Conversation

swissspidy
Copy link
Member

I have troubles running the unit tests if the plugin-check folder isn't within wp-content/plugins of an actual WordPress installation. I don't want to change my setup because of this.

  1. Remove separate build-phpunit folder.
    • We added this in the past because of different PHP version requirements.
    • Now that we require PHP 7.2+, this is no longer needed and we can simplify our testing setup.
  2. Remove plugin validation in Force_Single_Plugin_Preparation
    • Runtime check unit tests call this with the basename of the Plugin Check plugin
    • In my setup, I check out the plugin-check repository somewhere else on the computer, not within a WordPress installation.
    • Because of this, the validation would fail all my tests because the plugin couldn't be found
    • I don't see a strong need for this validation
    • Outright removing it is simpler than some additional logic to make this scenario work

With these changes I can now easily run tests locally using WP_TESTS_DIR=/path/to/wordpress-develop/tests/phpunit composer test

There are still some errors and failures, particularly in Plugin_Context_Tests and Check_Context_Tests, because of plugin path differences.

We added this in the past because of different PHP version requirements.

Now that we require PHP 7.2+, this is no longer needed and we can simplify our testing setup.
@swissspidy swissspidy added the Infrastructure Issues for the overall plugin infrastructure label Jul 12, 2024
@swissspidy
Copy link
Member Author

Interesting test failures right now 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Issues for the overall plugin infrastructure
1 participant