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

Set WordPress minimum version to 5.9 & update PHPUnit #724

Merged
merged 17 commits into from
May 22, 2024

Conversation

alecgeatches
Copy link
Contributor

@alecgeatches alecgeatches commented May 22, 2024

This PR makes a handful of changes to PHP unit tests to run with phpunit ^9.0:

  • Simplified test matrix to PHP 7.4/WP 5.9 (lowest support), and PHP latest/WP latest.

  • Use wp-env for setting up WordPress/testing environment rather than bin/install-wp-tests.sh and friends. I based this on previous work in another repository. This simplifies running tests in GitHub Actions and locally to work the same:

    wp-env start
    composer run integration
  • Removed wp-env-specific configuration from package.json. The docker compose overrides did not appear necessary nor did the rest of the configuration.

  • Updated the tests bootstrap.php file to the latest from wp scaffold plugin-tests, and also added a small change to enable email-related tests to work.

  • Added a bunch of protected and : void return types to unit test functions (e.g. setUp(), tearDown()) to match PHPUnit 9's parent classes.

  • Changed some ->assertContains() calls to ->assertStringContainsString() when used in a string context. assertContains() for strings was deprecated in PHPUnit 8.

  • Removed behat-test.yml. Apparently this test was added by a bot last year. The referenced workflow checks for a behat.yml file before running, and I can't find any reference to behat configuration ever in this repository. These were previously causing alerts for "cancelled" checks on each test run:

    image

@alecgeatches alecgeatches marked this pull request as ready for review May 22, 2024 21:21
@alecgeatches alecgeatches merged commit e1ee3a2 into develop May 22, 2024
3 checks passed
@alecgeatches alecgeatches deleted the add/lint-step-php branch May 22, 2024 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants