Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#51456 closed feature request (fixed)

Add an NPM command for easier PHPUnit testing on PHP 8

Reported by: desrosj's profile desrosj Owned by: desrosj's profile desrosj
Milestone: 5.6 Priority: normal
Severity: normal Version: 5.6
Component: Build/Test Tools Keywords: has-patch php8
Focuses: Cc:

Description (last modified by SergeyBiryukov)

In order to maintain PHP 5.6.20 support and add support for PHP 8, Composer is currently being used to force PHPUnit 7.x for PHP 8 (see r48957 and r49037). It would be great to have an NPM command that makes it easier to run the test suite with the Composer installed version of PHPunit.

Something like npm run test:php8. It could also be more general (maybe npm run test:php-composer) in case the Composer installed version is desired past this compatibility shim.

Attachments (2)

51456.diff (550 bytes) - added by desrosj 4 years ago.
51456.2.diff (2.3 KB) - added by desrosj 4 years ago.
Also update .travis.yml file to use the new NPM script.

Download all attachments as: .zip

Change History (10)

4 years ago

#1 @desrosj
4 years ago

  • Description modified (diff)

#2 @SergeyBiryukov
4 years ago

  • Description modified (diff)

#3 @SergeyBiryukov
4 years ago

  • Keywords php8 added

This ticket was mentioned in PR #572 on WordPress/wordpress-develop by desrosj.

4 years ago

Also updates the .travis.yml file to use this script.


4 years ago

Also update .travis.yml file to use the new NPM script.

#5 @desrosj
4 years ago

  • Owner set to desrosj
  • Resolution set to fixed
  • Status changed from new to closed

In 49099:

Build/Test Tools: Add NPM script for using the Composer installed version of PHPUnit.

The test:php NPM script runs the PHP test suite using the system installed version of PHPUnit. In some cases, the version of PHPUnit installed through Composer may be preferred.

Currently, this is true when running the test suite using PHP 8. In order to add support for PHP 8 while maintaining compatibility for PHP 5.6.20, PHPUnit 7.x must be used. But, some modifications are required to be compatible with PHP 8 (see [49037], [48957]).

This change introduces the test:php-composer NPM script, which will run the test suite using the composer installed version.

Props desrosj, SergeyBiryukov.
Fixes #51456.

desrosj commented on PR #572:

4 years ago

Merged into core in revision 49099.

#7 @desrosj
4 years ago

In 49100:

Build/Test Tools: Ensure arguments are passed correctly for test:php-composer commands.

Follow-up to [49099].

Props swissspidy.
See #51456.

This ticket was mentioned in Slack in #core by sergey. View the logs.

4 years ago

Note: See TracTickets for help on using tickets.