WordPress.org

Make WordPress Core

Changeset 49099


Ignore:
Timestamp:
10/07/2020 01:08:20 PM (2 weeks ago)
Author:
desrosj
Message:

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.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/.travis.yml

    r49077 r49099  
    4343      # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated,
    4444      # as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead.
    45       - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist
    46       - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group ajax
    47       - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml
    48       - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files
    49       - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http
    50       - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group restapi-jsclient
     45      - npm run test:php-composer --verbose -c phpunit.xml.dist
     46      - npm run test:php-composer --verbose -c phpunit.xml.dist --group ajax
     47      - npm run test:php-composer --verbose -c tests/phpunit/multisite.xml
     48      - npm run test:php-composer --verbose -c tests/phpunit/multisite.xml --group ms-files
     49      - npm run test:php-composer --verbose -c phpunit.xml.dist --group external-http
     50      - npm run test:php-composer --verbose -c phpunit.xml.dist --group restapi-jsclient
    5151      # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
    5252      # Xdebug supports PHP 8 only from version 3.0, which is not released yet.
  • trunk/package.json

    r48884 r49099  
    168168        "env:pull": "node ./tools/local-env/scripts/docker.js pull",
    169169        "test:php": "node ./tools/local-env/scripts/docker.js run --rm phpunit phpunit",
     170        "test:php-composer": "node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit",
    170171        "test:e2e": "node ./tests/e2e/run-tests.js"
    171172    }
Note: See TracChangeset for help on using the changeset viewer.