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.
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:
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 thanbin/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:Removed
wp-env
-specific configuration frompackage.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 fromwp 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 abehat.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: