Yoast / yoast-acf-analysis

WordPress plugin that adds the content of all ACF fields to the Yoast SEO score analysis.
https://wordpress.org/plugins/acf-content-analysis-for-yoast-seo/
GNU General Public License v3.0
61 stars 20 forks source link

QA: Make the unit tests PHPUnit cross-version compatible #201

Closed jrfnl closed 5 years ago

jrfnl commented 5 years ago

Summary

This PR can be summarized in the following changelog entry:

Relevant technical choices:

The unit tests for ACF have a minimum PHP requirement of PHP 5.6 due to the dependency on BrainMonkey.

At this time, the only PHPUnit version supported was PHPUnit 5.x. However, as the minimum PHP requirement is 5.6 anyway, it is quite easy to make the unit tests compatible with PHPUnit 5.x - 7.x.

PHPUnit 5.x will run on PHP 5.6 - 7.1. PHPUnit 6.x will run on PHP 7.0 - 7.2. PHPUnit 7.x will run on PHP 7.1 - 7.3.

For now, PHPUnit 7.x will also work fine for PHP 7.4 (unstable), so supporting PHPUnit 8.x is not yet necessary. Ref: https://phpunit.de/supported-versions.html

Background: The classes in PHPUnit have been renamed to namespaced classes. The namespaced alias for the TestCase class is available as of PHPUnit 5.4 and as of PHPUnit 6.0, the non-namespaced versions are no longer available.

As PHPUnit 5.4 is available to use on PHP 5.6, all that is needed to make the test suite compatible with PHPUnit 5.x - 7.x, is to switch over to using the namespaced PHPUnit classes.

Includes a minor tweak to the PHPCS ruleset to get round a "modern PHP not (yet) fully accounted for correctly" bug in WPCS.

CI/QA: minor tweaks to the phpunit.xml.dist file

The specs for the phpunit.xml.dist file have changed numerous times over the years with new options being added and outdated options being removed. These specs are contained in a schema XSD file for each minor PHPUnit version.

This commit:

Test instructions

This PR can be tested by following these steps:

IreneStr commented 5 years ago

CR 👍