WordPress.org

Make WordPress Core

Ticket #50902: 50902-1-travis-test-on-php8-separate-script.patch

File 50902-1-travis-test-on-php8-separate-script.patch, 18.9 KB (added by jrf, 7 months ago)

This patch contains the previous changes + runs the tests runs on PHP 8 individually instead of chained.

  • .travis.yml

    From 9f2295384f0342f8bfc1ead2eca0ace9e92d5c80 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Tue, 11 Aug 2020 04:18:40 +0200
    Subject: [PATCH] Travis: don't use the PHPUnit phar on nightly
    
    ... use `composer install` instead.
    
    The unit tests currently aren't running on PHP 8.0/nightly, which is kind of detrimental for any preparation efforts to make WP compatible with PHP 8.0.
    
    The reason for this that one of the dependencies of PHPUnit _itself_ at version 7.x is not compatible with PHP 8.0 at the version which is included in the last PHPUnit 7.x phar.
    
    The problematic dependency _has_ released a new version in which the problem is resolved, however as PHPUnit 7 is no longer supported, the phar will not be updated with this more recent dependency.
    
    Doing a `composer install` and running the tests via the composer installed PHPUnit version will solve this as the more recent version of the dependency will be used in that case.
    
    This commit implements this work-around in the Travis script to allow the tests to run on PHP 8.0.
    
    ---
    
    PHP 8.0 raises the error level of quite some notices and warnings to (catchable) exceptions, which when uncaught result in fatal errors.
    PHP 8.0 also makes a number of changes in how numeric strings are handled in comparisons.
    
    In nearly all cases, issues resulting from either or these changes will **NOT** be detectable by static analysis tools as it involves the runtime value of variables.
    
    So being able to see which tests are failing and with what error message is imperative to being able to make WP compatible with PHP 8.0.
    
    Composer: update PHPUnit dependencies
    
    Travis: run all unit tests on PHP 8
    
    As per https://core.trac.wordpress.org/ticket/50902#comment:6
    ---
     .travis.yml   |  26 +++++++-
     composer.lock | 162 ++++++++++++++++++++++++++++++--------------------
     2 files changed, 119 insertions(+), 69 deletions(-)
    
    diff --git a/.travis.yml b/.travis.yml
    index 9674c79364..6bc8707b45 100644
    a b jobs: 
    5151    name: "PHPUnit Tests: PHP 7.0"
    5252  - env: LOCAL_PHP=5.6-fpm WP_TRAVISCI=test:php
    5353    name: "PHPUnit Tests: PHP 5.6"
    54   - env: LOCAL_PHP=8.0-fpm WP_TRAVISCI=test:php
     54  - env: LOCAL_PHP=8.0-fpm COMPOSER_INSTALL=true WP_TRAVISCI=test:php
    5555    name: "PHPUnit Tests: PHP 8.0"
     56    script:
     57      # The PHPUnit 7.x phar is not compatible with PHP 8 and won't be updated as PHPUnit 7 is no
     58      # longer supported, so run the composer installed PHPUnit instead.
     59      - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist
     60      - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group ajax
     61      - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml
     62      - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files
     63      - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http
     64      - docker-compose run --rm phpunit php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group restapi-jsclient
     65      # __fakegroup__ is excluded to force PHPUnit to ignore the <exclude> settings in phpunit.xml.dist.
     66      - LOCAL_PHP_XDEBUG=true docker-compose run --rm phpunit phpunit -v --group xdebug --exclude-group __fakegroup__
     67
    5668  allow_failures:
    57   - env: LOCAL_PHP=8.0-fpm WP_TRAVISCI=test:php
     69  - env: LOCAL_PHP=8.0-fpm COMPOSER_INSTALL=true WP_TRAVISCI=test:php
    5870  fast_finish: true
    5971
    6072before_install:
    before_install: 
    7082
    7183before_script:
    7284- |
    73   if [[ "$COMPOSER_INSTALL" == "true" ]]; then
     85  if [[ "$COMPOSER_INSTALL" == "true" && ${LOCAL_PHP:0:3} != "8.0" ]]; then
    7486    docker-compose run --rm php composer --version
    7587    docker-compose run --rm php composer install
     88  elif [[ "$COMPOSER_INSTALL" == "true" && ${LOCAL_PHP:0:3} == "8.0" ]]; then
     89    docker-compose run --rm php composer --version
     90    docker-compose run --rm php composer install --ignore-platform-reqs
    7691  fi
    7792- npm --version
    7893- node --version
    before_script: 
    88103    docker-compose run --rm mysql mysql --version
    89104    docker-compose run --rm php php --version
    90105    docker-compose run --rm php php -m
     106  fi
     107- |
     108  if [[ ${LOCAL_PHP:0:3} == "8.0" ]]; then
     109    docker-compose run --rm phpunit php ./vendor/bin/phpunit --version
     110  elif [[ "$WP_TRAVISCI" == "test:e2e" ]] || [[ "$WP_TRAVISCI" == "test:php" ]]; then
    91111    docker-compose run --rm phpunit phpunit --version
    92112  fi
    93113- |
  • composer.lock

    diff --git a/composer.lock b/composer.lock
    index 61e728d04e..d189396da6 100644
    a b  
    131131        },
    132132        {
    133133            "name": "myclabs/deep-copy",
    134             "version": "1.9.5",
     134            "version": "1.10.1",
    135135            "source": {
    136136                "type": "git",
    137137                "url": "https://github.com/myclabs/DeepCopy.git",
    138                 "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef"
     138                "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5"
    139139            },
    140140            "dist": {
    141141                "type": "zip",
    142                 "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef",
    143                 "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef",
     142                "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/969b211f9a51aa1f6c01d1d2aef56d3bd91598e5",
     143                "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5",
    144144                "shasum": ""
    145145            },
    146146            "require": {
    147                 "php": "^7.1"
     147                "php": "^7.1 || ^8.0"
    148148            },
    149149            "replace": {
    150150                "myclabs/deep-copy": "self.version"
     
    175175                "object",
    176176                "object graph"
    177177            ],
    178             "time": "2020-01-17T21:11:47+00:00"
     178            "funding": [
     179                {
     180                    "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
     181                    "type": "tidelift"
     182                }
     183            ],
     184            "time": "2020-06-29T13:22:24+00:00"
    179185        },
    180186        {
    181187            "name": "phar-io/manifest",
     
    441447        },
    442448        {
    443449            "name": "phpdocumentor/reflection-common",
    444             "version": "2.1.0",
     450            "version": "2.2.0",
    445451            "source": {
    446452                "type": "git",
    447453                "url": "https://github.com/phpDocumentor/ReflectionCommon.git",
    448                 "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b"
     454                "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b"
    449455            },
    450456            "dist": {
    451457                "type": "zip",
    452                 "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/6568f4687e5b41b054365f9ae03fcb1ed5f2069b",
    453                 "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b",
     458                "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b",
     459                "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b",
    454460                "shasum": ""
    455461            },
    456462            "require": {
    457                 "php": ">=7.1"
     463                "php": "^7.2 || ^8.0"
    458464            },
    459465            "type": "library",
    460466            "extra": {
    461467                "branch-alias": {
    462                     "dev-master": "2.x-dev"
     468                    "dev-2.x": "2.x-dev"
    463469                }
    464470            },
    465471            "autoload": {
     
    486492                "reflection",
    487493                "static analysis"
    488494            ],
    489             "time": "2020-04-27T09:25:28+00:00"
     495            "time": "2020-06-27T09:03:43+00:00"
    490496        },
    491497        {
    492498            "name": "phpdocumentor/reflection-docblock",
    493             "version": "5.1.0",
     499            "version": "5.2.0",
    494500            "source": {
    495501                "type": "git",
    496502                "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
    497                 "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e"
     503                "reference": "3170448f5769fe19f456173d833734e0ff1b84df"
    498504            },
    499505            "dist": {
    500506                "type": "zip",
    501                 "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e",
    502                 "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e",
     507                "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/3170448f5769fe19f456173d833734e0ff1b84df",
     508                "reference": "3170448f5769fe19f456173d833734e0ff1b84df",
    503509                "shasum": ""
    504510            },
    505511            "require": {
    506                 "ext-filter": "^7.1",
    507                 "php": "^7.2",
    508                 "phpdocumentor/reflection-common": "^2.0",
    509                 "phpdocumentor/type-resolver": "^1.0",
    510                 "webmozart/assert": "^1"
     512                "ext-filter": "*",
     513                "php": "^7.2 || ^8.0",
     514                "phpdocumentor/reflection-common": "^2.2",
     515                "phpdocumentor/type-resolver": "^1.3",
     516                "webmozart/assert": "^1.9.1"
    511517            },
    512518            "require-dev": {
    513                 "doctrine/instantiator": "^1",
    514                 "mockery/mockery": "^1"
     519                "mockery/mockery": "~1.3.2"
    515520            },
    516521            "type": "library",
    517522            "extra": {
     
    539544                }
    540545            ],
    541546            "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
    542             "time": "2020-02-22T12:28:44+00:00"
     547            "time": "2020-07-20T20:05:34+00:00"
    543548        },
    544549        {
    545550            "name": "phpdocumentor/type-resolver",
    546             "version": "1.1.0",
     551            "version": "1.3.0",
    547552            "source": {
    548553                "type": "git",
    549554                "url": "https://github.com/phpDocumentor/TypeResolver.git",
    550                 "reference": "7462d5f123dfc080dfdf26897032a6513644fc95"
     555                "reference": "e878a14a65245fbe78f8080eba03b47c3b705651"
    551556            },
    552557            "dist": {
    553558                "type": "zip",
    554                 "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95",
    555                 "reference": "7462d5f123dfc080dfdf26897032a6513644fc95",
     559                "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e878a14a65245fbe78f8080eba03b47c3b705651",
     560                "reference": "e878a14a65245fbe78f8080eba03b47c3b705651",
    556561                "shasum": ""
    557562            },
    558563            "require": {
    559                 "php": "^7.2",
     564                "php": "^7.2 || ^8.0",
    560565                "phpdocumentor/reflection-common": "^2.0"
    561566            },
    562567            "require-dev": {
    563                 "ext-tokenizer": "^7.2",
    564                 "mockery/mockery": "~1"
     568                "ext-tokenizer": "*"
    565569            },
    566570            "type": "library",
    567571            "extra": {
    568572                "branch-alias": {
    569                     "dev-master": "1.x-dev"
     573                    "dev-1.x": "1.x-dev"
    570574                }
    571575            },
    572576            "autoload": {
     
    585589                }
    586590            ],
    587591            "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names",
    588             "time": "2020-02-18T18:59:58+00:00"
     592            "time": "2020-06-27T10:12:23+00:00"
    589593        },
    590594        {
    591595            "name": "phpspec/prophecy",
    592             "version": "v1.10.3",
     596            "version": "1.11.1",
    593597            "source": {
    594598                "type": "git",
    595599                "url": "https://github.com/phpspec/prophecy.git",
    596                 "reference": "451c3cd1418cf640de218914901e51b064abb093"
     600                "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160"
    597601            },
    598602            "dist": {
    599603                "type": "zip",
    600                 "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093",
    601                 "reference": "451c3cd1418cf640de218914901e51b064abb093",
     604                "url": "https://api.github.com/repos/phpspec/prophecy/zipball/b20034be5efcdab4fb60ca3a29cba2949aead160",
     605                "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160",
    602606                "shasum": ""
    603607            },
    604608            "require": {
    605                 "doctrine/instantiator": "^1.0.2",
    606                 "php": "^5.3|^7.0",
    607                 "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0",
    608                 "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0",
    609                 "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0"
     609                "doctrine/instantiator": "^1.2",
     610                "php": "^7.2",
     611                "phpdocumentor/reflection-docblock": "^5.0",
     612                "sebastian/comparator": "^3.0 || ^4.0",
     613                "sebastian/recursion-context": "^3.0 || ^4.0"
    610614            },
    611615            "require-dev": {
    612                 "phpspec/phpspec": "^2.5 || ^3.2",
    613                 "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1"
     616                "phpspec/phpspec": "^6.0",
     617                "phpunit/phpunit": "^8.0"
    614618            },
    615619            "type": "library",
    616620            "extra": {
    617621                "branch-alias": {
    618                     "dev-master": "1.10.x-dev"
     622                    "dev-master": "1.11.x-dev"
    619623                }
    620624            },
    621625            "autoload": {
     
    648652                "spy",
    649653                "stub"
    650654            ],
    651             "time": "2020-03-05T15:02:03+00:00"
     655            "time": "2020-07-08T12:44:21+00:00"
    652656        },
    653657        {
    654658            "name": "phpunit/php-code-coverage",
     
    16051609        },
    16061610        {
    16071611            "name": "symfony/polyfill-ctype",
    1608             "version": "v1.17.0",
     1612            "version": "v1.18.1",
    16091613            "source": {
    16101614                "type": "git",
    16111615                "url": "https://github.com/symfony/polyfill-ctype.git",
    1612                 "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9"
     1616                "reference": "1c302646f6efc070cd46856e600e5e0684d6b454"
    16131617            },
    16141618            "dist": {
    16151619                "type": "zip",
    1616                 "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
    1617                 "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9",
     1620                "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454",
     1621                "reference": "1c302646f6efc070cd46856e600e5e0684d6b454",
    16181622                "shasum": ""
    16191623            },
    16201624            "require": {
     
    16261630            "type": "library",
    16271631            "extra": {
    16281632                "branch-alias": {
    1629                     "dev-master": "1.17-dev"
     1633                    "dev-master": "1.18-dev"
     1634                },
     1635                "thanks": {
     1636                    "name": "symfony/polyfill",
     1637                    "url": "https://github.com/symfony/polyfill"
    16301638                }
    16311639            },
    16321640            "autoload": {
     
    16591667                "polyfill",
    16601668                "portable"
    16611669            ],
    1662             "time": "2020-05-12T16:14:59+00:00"
     1670            "funding": [
     1671                {
     1672                    "url": "https://symfony.com/sponsor",
     1673                    "type": "custom"
     1674                },
     1675                {
     1676                    "url": "https://github.com/fabpot",
     1677                    "type": "github"
     1678                },
     1679                {
     1680                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
     1681                    "type": "tidelift"
     1682                }
     1683            ],
     1684            "time": "2020-07-14T12:35:20+00:00"
    16631685        },
    16641686        {
    16651687            "name": "theseer/tokenizer",
    1666             "version": "1.1.3",
     1688            "version": "1.2.0",
    16671689            "source": {
    16681690                "type": "git",
    16691691                "url": "https://github.com/theseer/tokenizer.git",
    1670                 "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9"
     1692                "reference": "75a63c33a8577608444246075ea0af0d052e452a"
    16711693            },
    16721694            "dist": {
    16731695                "type": "zip",
    1674                 "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9",
    1675                 "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9",
     1696                "url": "https://api.github.com/repos/theseer/tokenizer/zipball/75a63c33a8577608444246075ea0af0d052e452a",
     1697                "reference": "75a63c33a8577608444246075ea0af0d052e452a",
    16761698                "shasum": ""
    16771699            },
    16781700            "require": {
    16791701                "ext-dom": "*",
    16801702                "ext-tokenizer": "*",
    16811703                "ext-xmlwriter": "*",
    1682                 "php": "^7.0"
     1704                "php": "^7.2 || ^8.0"
    16831705            },
    16841706            "type": "library",
    16851707            "autoload": {
     
    16991721                }
    17001722            ],
    17011723            "description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
    1702             "time": "2019-06-13T22:48:21+00:00"
     1724            "funding": [
     1725                {
     1726                    "url": "https://github.com/theseer",
     1727                    "type": "github"
     1728                }
     1729            ],
     1730            "time": "2020-07-12T23:59:07+00:00"
    17031731        },
    17041732        {
    17051733            "name": "webmozart/assert",
    1706             "version": "1.8.0",
     1734            "version": "1.9.1",
    17071735            "source": {
    17081736                "type": "git",
    17091737                "url": "https://github.com/webmozart/assert.git",
    1710                 "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6"
     1738                "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389"
    17111739            },
    17121740            "dist": {
    17131741                "type": "zip",
    1714                 "url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
    1715                 "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6",
     1742                "url": "https://api.github.com/repos/webmozart/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389",
     1743                "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389",
    17161744                "shasum": ""
    17171745            },
    17181746            "require": {
    1719                 "php": "^5.3.3 || ^7.0",
     1747                "php": "^5.3.3 || ^7.0 || ^8.0",
    17201748                "symfony/polyfill-ctype": "^1.8"
    17211749            },
    17221750            "conflict": {
     1751                "phpstan/phpstan": "<0.12.20",
    17231752                "vimeo/psalm": "<3.9.1"
    17241753            },
    17251754            "require-dev": {
     
    17471776                "check",
    17481777                "validate"
    17491778            ],
    1750             "time": "2020-04-18T12:12:48+00:00"
     1779            "time": "2020-07-08T17:02:28+00:00"
    17511780        },
    17521781        {
    17531782            "name": "wp-coding-standards/wpcs",
     
    18041833    "platform": {
    18051834        "php": ">=5.6"
    18061835    },
    1807     "platform-dev": []
     1836    "platform-dev": [],
     1837    "plugin-api-version": "1.1.0"
    18081838}