WordPress.org

Make WordPress Core

Opened 4 months ago

Closed 4 months ago

Last modified 4 months ago

#51456 closed feature request (fixed)

Add an NPM command for easier PHPUnit testing on PHP 8

Reported by: desrosj Owned by: 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 months ago.
51456.2.diff (2.3 KB) - added by desrosj 4 months ago.
Also update .travis.yml file to use the new NPM script.

Download all attachments as: .zip

Change History (10)

@desrosj
4 months ago

#1 @desrosj
4 months ago

  • Description modified (diff)

#2 @SergeyBiryukov
4 months ago

  • Description modified (diff)

#3 @SergeyBiryukov
4 months ago

  • Keywords php8 added

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


4 months ago

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

Ticket: https://core.trac.wordpress.org/ticket/51456

@desrosj
4 months ago

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

#5 @desrosj
4 months 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.

#6 @prbot
4 months ago

desrosj commented on PR #572:

Merged into core in revision 49099.

#7 @desrosj
4 months 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 months ago

Note: See TracTickets for help on using tickets.