From 683ecf8c6a1b800978735ec4a1a7a5975647d9e5 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Wed, 7 Oct 2020 13:08:20 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@49099 602fd350-edb4-49c9-b593-d223f7449a82 --- .travis.yml | 12 ++++++------ package.json | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index e32a541bdb..1150e9aa13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,12 +42,12 @@ jobs: script: # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated, # as PHPUnit 7 is no longer supported, so run the Composer-installed PHPUnit instead. - - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist - - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group ajax - - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml - - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files - - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http - - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group restapi-jsclient + - npm run test:php-composer --verbose -c phpunit.xml.dist + - npm run test:php-composer --verbose -c phpunit.xml.dist --group ajax + - npm run test:php-composer --verbose -c tests/phpunit/multisite.xml + - npm run test:php-composer --verbose -c tests/phpunit/multisite.xml --group ms-files + - npm run test:php-composer --verbose -c phpunit.xml.dist --group external-http + - npm run test:php-composer --verbose -c phpunit.xml.dist --group restapi-jsclient # __fakegroup__ is excluded to force PHPUnit to ignore the settings in phpunit.xml.dist. # Xdebug supports PHP 8 only from version 3.0, which is not released yet. # Once Xdebug 3.0 is released and included in the Docker image, this should be uncommented again. diff --git a/package.json b/package.json index 3331a46259..2f0d95ebeb 100644 --- a/package.json +++ b/package.json @@ -167,6 +167,7 @@ "env:logs": "node ./tools/local-env/scripts/docker.js logs", "env:pull": "node ./tools/local-env/scripts/docker.js pull", "test:php": "node ./tools/local-env/scripts/docker.js run --rm phpunit phpunit", + "test:php-composer": "node ./tools/local-env/scripts/docker.js run --rm phpunit php ./vendor/bin/phpunit", "test:e2e": "node ./tests/e2e/run-tests.js" } }