Make WordPress Core

Changeset 51574


Ignore:
Timestamp:
08/07/2021 11:41:53 AM (3 years ago)
Author:
SergeyBiryukov
Message:

Build/Test Tools: Loosen the PHPUnit restriction.

composer.json:

Remove the PHPUnit dependency in favor of allowing the PHPUnit Polyfills library to manage the supported PHPUnit version. This automatically now widens the supported PHPUnit versions to 5.7.21 to 9.5.8 (current).

Letting the PHPUnit Polyfills handle the version constraints for PHPUnit prevents potential version conflicts in the future, as well as allows WordPress to benefit straight away when a new PHPUnit version would be released and the PHPUnit Polyfills package adds support for that PHPUnit version.

Test Bootstrap

Update the supported version number for PHPUnit 5.x, as the minimum PHPUnit 5.x version supported by the PHPUnit Polyfills is PHPUnit 5.7.21, and remove the PHPUnit maximum.

.gitignore and svn:ignore:

Add the PHPUnit cache file to the list of files to be ignored.

Since PHPUnit 8, PHPUnit has a built-in caching feature which creates a .phpunit.result.cache file. This file should not be committed.

Follow-up to [40536], [40853], [44701], [51559-51573].

Props jrf.
See #46149.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        22.htaccess
        33# Files and folders related to build/test tools
         4.phpunit.result.cache
        45phpunit.xml
        56phpcs.xml
  • trunk/.gitignore

    r51543 r51574  
    77
    88# Files and folders related to build/test tools
     9.phpunit.result.cache
    910/phpunit.xml
    1011/.phpcs.xml
  • trunk/composer.json

    r51559 r51574  
    1818        "wp-coding-standards/wpcs": "~2.3.0",
    1919        "phpcompatibility/phpcompatibility-wp": "~2.1.2",
    20         "phpunit/phpunit": "^5.7 || ^6.5 || ^7.5",
    2120        "yoast/phpunit-polyfills": "^1.0"
    2221    },
  • trunk/tests/phpunit/includes/bootstrap.php

    r51561 r51574  
    3838$phpunit_version = tests_get_phpunit_version();
    3939
    40 if ( version_compare( $phpunit_version, '5.7', '<' ) || version_compare( $phpunit_version, '8.0', '>=' ) ) {
     40if ( version_compare( $phpunit_version, '5.7.21', '<' ) ) {
    4141    printf(
    42         "Error: Looks like you're using PHPUnit %s. WordPress requires at least PHPUnit 5.7 and is currently only compatible with PHPUnit up to 7.x.\n",
     42        "Error: Looks like you're using PHPUnit %s. WordPress requires at least PHPUnit 5.7.21.\n",
    4343        $phpunit_version
    4444    );
    45     echo "Please use the latest PHPUnit version from the 7.x branch.\n";
     45    echo "Please use the latest PHPUnit version supported for the PHP version you are running the tests on.\n";
    4646    exit( 1 );
    4747}
Note: See TracChangeset for help on using the changeset viewer.