[wp-trac] [WordPress Trac] #50639: [PHP 8] Add @requires annotations for PHPUnit tests that assert engine-enforced constraints
WordPress Trac
noreply at wordpress.org
Sun Jul 12 20:14:28 UTC 2020
#50639: [PHP 8] Add @requires annotations for PHPUnit tests that assert engine-
enforced constraints
------------------------------+-----------------------------
Reporter: ayeshrajans | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Build/Test Tools | Version:
Severity: normal | Keywords: php8
Focuses: |
------------------------------+-----------------------------
PHP 8.0 throws errors when certain build-in functions encounter unexpected
values.
Ref:
- https://php.watch/versions/8.0/internal-function-exceptions
- https://php.watch/versions/8.0/ValueError
In current PHP 8 builds, there are few test failures on tests that are
supposed to test how functions behave when they encounter unexpected
values. In PHP 8, it is not necessary to have these tests because they are
validated internally by the engine now.
We still need to keep these assertions for older PHP 8 versions.
- Adds `@requires PHP < 8` annotation to prevent PHPUnit from running the
test on PHP 8 and higher.
- Adds `@requires extension gd` to mark that the test requires `gd`
extension. This is to prevent "jpeg support required" test failures on
current PHP nightly builds. I think failing a test when the test
environment does not support the extension is not appropriate and we
should ideally skip that test instead. Fixing test-failures to mark tests
skipped is out of this ticket.
Note that PHPUnit 7.5 will be used for PHP 8 builds. `@required`
annotations are not supported in earlier versions such as 5.x and 6.x,
which WordPress still uses for older PHP versions. For PHP 8, PHPUnit 7.5
will be used, so using `@required` annotations is a progressive update.
It is also acknowledged that this is an early ticket for PHP 8.
Practically speaking, we are looking to target WordPress 5.6 for this
ticket.
With this ticket, we change the tests from:
`Tests: 10860, Assertions: 52721, Errors: 37, Failures: 20, Skipped: 97,
Risky: 3.`
(https://travis-ci.com/github/Ayesh/wordpress-
develop/jobs/360267882#L3836)
To:
`Tests: 10860, Assertions: 52679, Errors: 30, Failures: 10, Skipped: 121,
Risky: 3`
(https://travis-ci.com/github/Ayesh/wordpress-
develop/jobs/360274089#L3808)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50639>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list