Skip to content

Set WordPress minimum version to 5.9 & update PHPUnit#724

Merged
alecgeatches merged 17 commits intodevelopfrom
add/lint-step-php
May 22, 2024
Merged

Set WordPress minimum version to 5.9 & update PHPUnit#724
alecgeatches merged 17 commits intodevelopfrom
add/lint-step-php

Conversation

@alecgeatches
Copy link
Copy Markdown
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
@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