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: |
51 | 51 | name: "PHPUnit Tests: PHP 7.0" |
52 | 52 | - env: LOCAL_PHP=5.6-fpm WP_TRAVISCI=test:php |
53 | 53 | 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 |
55 | 55 | 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 | |
56 | 68 | 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 |
58 | 70 | fast_finish: true |
59 | 71 | |
60 | 72 | before_install: |
… |
… |
before_install: |
70 | 82 | |
71 | 83 | before_script: |
72 | 84 | - | |
73 | | if [[ "$COMPOSER_INSTALL" == "true" ]]; then |
| 85 | if [[ "$COMPOSER_INSTALL" == "true" && ${LOCAL_PHP:0:3} != "8.0" ]]; then |
74 | 86 | docker-compose run --rm php composer --version |
75 | 87 | 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 |
76 | 91 | fi |
77 | 92 | - npm --version |
78 | 93 | - node --version |
… |
… |
before_script: |
88 | 103 | docker-compose run --rm mysql mysql --version |
89 | 104 | docker-compose run --rm php php --version |
90 | 105 | 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 |
91 | 111 | docker-compose run --rm phpunit phpunit --version |
92 | 112 | fi |
93 | 113 | - | |
diff --git a/composer.lock b/composer.lock
index 61e728d04e..d189396da6 100644
a
|
b
|
|
131 | 131 | }, |
132 | 132 | { |
133 | 133 | "name": "myclabs/deep-copy", |
134 | | "version": "1.9.5", |
| 134 | "version": "1.10.1", |
135 | 135 | "source": { |
136 | 136 | "type": "git", |
137 | 137 | "url": "https://github.com/myclabs/DeepCopy.git", |
138 | | "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" |
| 138 | "reference": "969b211f9a51aa1f6c01d1d2aef56d3bd91598e5" |
139 | 139 | }, |
140 | 140 | "dist": { |
141 | 141 | "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", |
144 | 144 | "shasum": "" |
145 | 145 | }, |
146 | 146 | "require": { |
147 | | "php": "^7.1" |
| 147 | "php": "^7.1 || ^8.0" |
148 | 148 | }, |
149 | 149 | "replace": { |
150 | 150 | "myclabs/deep-copy": "self.version" |
… |
… |
|
175 | 175 | "object", |
176 | 176 | "object graph" |
177 | 177 | ], |
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" |
179 | 185 | }, |
180 | 186 | { |
181 | 187 | "name": "phar-io/manifest", |
… |
… |
|
441 | 447 | }, |
442 | 448 | { |
443 | 449 | "name": "phpdocumentor/reflection-common", |
444 | | "version": "2.1.0", |
| 450 | "version": "2.2.0", |
445 | 451 | "source": { |
446 | 452 | "type": "git", |
447 | 453 | "url": "https://github.com/phpDocumentor/ReflectionCommon.git", |
448 | | "reference": "6568f4687e5b41b054365f9ae03fcb1ed5f2069b" |
| 454 | "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" |
449 | 455 | }, |
450 | 456 | "dist": { |
451 | 457 | "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", |
454 | 460 | "shasum": "" |
455 | 461 | }, |
456 | 462 | "require": { |
457 | | "php": ">=7.1" |
| 463 | "php": "^7.2 || ^8.0" |
458 | 464 | }, |
459 | 465 | "type": "library", |
460 | 466 | "extra": { |
461 | 467 | "branch-alias": { |
462 | | "dev-master": "2.x-dev" |
| 468 | "dev-2.x": "2.x-dev" |
463 | 469 | } |
464 | 470 | }, |
465 | 471 | "autoload": { |
… |
… |
|
486 | 492 | "reflection", |
487 | 493 | "static analysis" |
488 | 494 | ], |
489 | | "time": "2020-04-27T09:25:28+00:00" |
| 495 | "time": "2020-06-27T09:03:43+00:00" |
490 | 496 | }, |
491 | 497 | { |
492 | 498 | "name": "phpdocumentor/reflection-docblock", |
493 | | "version": "5.1.0", |
| 499 | "version": "5.2.0", |
494 | 500 | "source": { |
495 | 501 | "type": "git", |
496 | 502 | "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", |
497 | | "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" |
| 503 | "reference": "3170448f5769fe19f456173d833734e0ff1b84df" |
498 | 504 | }, |
499 | 505 | "dist": { |
500 | 506 | "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", |
503 | 509 | "shasum": "" |
504 | 510 | }, |
505 | 511 | "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" |
511 | 517 | }, |
512 | 518 | "require-dev": { |
513 | | "doctrine/instantiator": "^1", |
514 | | "mockery/mockery": "^1" |
| 519 | "mockery/mockery": "~1.3.2" |
515 | 520 | }, |
516 | 521 | "type": "library", |
517 | 522 | "extra": { |
… |
… |
|
539 | 544 | } |
540 | 545 | ], |
541 | 546 | "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" |
543 | 548 | }, |
544 | 549 | { |
545 | 550 | "name": "phpdocumentor/type-resolver", |
546 | | "version": "1.1.0", |
| 551 | "version": "1.3.0", |
547 | 552 | "source": { |
548 | 553 | "type": "git", |
549 | 554 | "url": "https://github.com/phpDocumentor/TypeResolver.git", |
550 | | "reference": "7462d5f123dfc080dfdf26897032a6513644fc95" |
| 555 | "reference": "e878a14a65245fbe78f8080eba03b47c3b705651" |
551 | 556 | }, |
552 | 557 | "dist": { |
553 | 558 | "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", |
556 | 561 | "shasum": "" |
557 | 562 | }, |
558 | 563 | "require": { |
559 | | "php": "^7.2", |
| 564 | "php": "^7.2 || ^8.0", |
560 | 565 | "phpdocumentor/reflection-common": "^2.0" |
561 | 566 | }, |
562 | 567 | "require-dev": { |
563 | | "ext-tokenizer": "^7.2", |
564 | | "mockery/mockery": "~1" |
| 568 | "ext-tokenizer": "*" |
565 | 569 | }, |
566 | 570 | "type": "library", |
567 | 571 | "extra": { |
568 | 572 | "branch-alias": { |
569 | | "dev-master": "1.x-dev" |
| 573 | "dev-1.x": "1.x-dev" |
570 | 574 | } |
571 | 575 | }, |
572 | 576 | "autoload": { |
… |
… |
|
585 | 589 | } |
586 | 590 | ], |
587 | 591 | "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" |
589 | 593 | }, |
590 | 594 | { |
591 | 595 | "name": "phpspec/prophecy", |
592 | | "version": "v1.10.3", |
| 596 | "version": "1.11.1", |
593 | 597 | "source": { |
594 | 598 | "type": "git", |
595 | 599 | "url": "https://github.com/phpspec/prophecy.git", |
596 | | "reference": "451c3cd1418cf640de218914901e51b064abb093" |
| 600 | "reference": "b20034be5efcdab4fb60ca3a29cba2949aead160" |
597 | 601 | }, |
598 | 602 | "dist": { |
599 | 603 | "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", |
602 | 606 | "shasum": "" |
603 | 607 | }, |
604 | 608 | "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" |
610 | 614 | }, |
611 | 615 | "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" |
614 | 618 | }, |
615 | 619 | "type": "library", |
616 | 620 | "extra": { |
617 | 621 | "branch-alias": { |
618 | | "dev-master": "1.10.x-dev" |
| 622 | "dev-master": "1.11.x-dev" |
619 | 623 | } |
620 | 624 | }, |
621 | 625 | "autoload": { |
… |
… |
|
648 | 652 | "spy", |
649 | 653 | "stub" |
650 | 654 | ], |
651 | | "time": "2020-03-05T15:02:03+00:00" |
| 655 | "time": "2020-07-08T12:44:21+00:00" |
652 | 656 | }, |
653 | 657 | { |
654 | 658 | "name": "phpunit/php-code-coverage", |
… |
… |
|
1605 | 1609 | }, |
1606 | 1610 | { |
1607 | 1611 | "name": "symfony/polyfill-ctype", |
1608 | | "version": "v1.17.0", |
| 1612 | "version": "v1.18.1", |
1609 | 1613 | "source": { |
1610 | 1614 | "type": "git", |
1611 | 1615 | "url": "https://github.com/symfony/polyfill-ctype.git", |
1612 | | "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9" |
| 1616 | "reference": "1c302646f6efc070cd46856e600e5e0684d6b454" |
1613 | 1617 | }, |
1614 | 1618 | "dist": { |
1615 | 1619 | "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", |
1618 | 1622 | "shasum": "" |
1619 | 1623 | }, |
1620 | 1624 | "require": { |
… |
… |
|
1626 | 1630 | "type": "library", |
1627 | 1631 | "extra": { |
1628 | 1632 | "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" |
1630 | 1638 | } |
1631 | 1639 | }, |
1632 | 1640 | "autoload": { |
… |
… |
|
1659 | 1667 | "polyfill", |
1660 | 1668 | "portable" |
1661 | 1669 | ], |
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" |
1663 | 1685 | }, |
1664 | 1686 | { |
1665 | 1687 | "name": "theseer/tokenizer", |
1666 | | "version": "1.1.3", |
| 1688 | "version": "1.2.0", |
1667 | 1689 | "source": { |
1668 | 1690 | "type": "git", |
1669 | 1691 | "url": "https://github.com/theseer/tokenizer.git", |
1670 | | "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" |
| 1692 | "reference": "75a63c33a8577608444246075ea0af0d052e452a" |
1671 | 1693 | }, |
1672 | 1694 | "dist": { |
1673 | 1695 | "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", |
1676 | 1698 | "shasum": "" |
1677 | 1699 | }, |
1678 | 1700 | "require": { |
1679 | 1701 | "ext-dom": "*", |
1680 | 1702 | "ext-tokenizer": "*", |
1681 | 1703 | "ext-xmlwriter": "*", |
1682 | | "php": "^7.0" |
| 1704 | "php": "^7.2 || ^8.0" |
1683 | 1705 | }, |
1684 | 1706 | "type": "library", |
1685 | 1707 | "autoload": { |
… |
… |
|
1699 | 1721 | } |
1700 | 1722 | ], |
1701 | 1723 | "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" |
1703 | 1731 | }, |
1704 | 1732 | { |
1705 | 1733 | "name": "webmozart/assert", |
1706 | | "version": "1.8.0", |
| 1734 | "version": "1.9.1", |
1707 | 1735 | "source": { |
1708 | 1736 | "type": "git", |
1709 | 1737 | "url": "https://github.com/webmozart/assert.git", |
1710 | | "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6" |
| 1738 | "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" |
1711 | 1739 | }, |
1712 | 1740 | "dist": { |
1713 | 1741 | "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", |
1716 | 1744 | "shasum": "" |
1717 | 1745 | }, |
1718 | 1746 | "require": { |
1719 | | "php": "^5.3.3 || ^7.0", |
| 1747 | "php": "^5.3.3 || ^7.0 || ^8.0", |
1720 | 1748 | "symfony/polyfill-ctype": "^1.8" |
1721 | 1749 | }, |
1722 | 1750 | "conflict": { |
| 1751 | "phpstan/phpstan": "<0.12.20", |
1723 | 1752 | "vimeo/psalm": "<3.9.1" |
1724 | 1753 | }, |
1725 | 1754 | "require-dev": { |
… |
… |
|
1747 | 1776 | "check", |
1748 | 1777 | "validate" |
1749 | 1778 | ], |
1750 | | "time": "2020-04-18T12:12:48+00:00" |
| 1779 | "time": "2020-07-08T17:02:28+00:00" |
1751 | 1780 | }, |
1752 | 1781 | { |
1753 | 1782 | "name": "wp-coding-standards/wpcs", |
… |
… |
|
1804 | 1833 | "platform": { |
1805 | 1834 | "php": ">=5.6" |
1806 | 1835 | }, |
1807 | | "platform-dev": [] |
| 1836 | "platform-dev": [], |
| 1837 | "plugin-api-version": "1.1.0" |
1808 | 1838 | } |