[wp-trac] [WordPress Trac] #53911: Test modernization backwards-compatibility backports to help security test backports and extenders with WordPress cross-version testing
WordPress Trac
noreply at wordpress.org
Thu Sep 23 17:09:46 UTC 2021
#53911: Test modernization backwards-compatibility backports to help security test
backports and extenders with WordPress cross-version testing
------------------------------+----------------------
Reporter: hellofromTonya | Owner: desrosj
Type: task (blessed) | Status: closed
Priority: normal | Milestone: 5.9
Component: Build/Test Tools | Version:
Severity: normal | Resolution: fixed
Keywords: has-patch commit | Focuses:
------------------------------+----------------------
Comment (by bjorsch):
> Allow tests which need to be backported for the security test suite to
be backported to older WP versions without the need to make significant
changes to these tests to get them to run.
If I understand correctly, the intent of this is to allow for a test
written for 5.9, that uses `set_up()`, to be backported to 5.8 and earlier
without having to rename that to `setUp()`.
If so, it looks like you got it exactly backwards in
https://core.trac.wordpress.org/changeset/51838#file6. What you need for
the tests to actually work is to have `setUp()` call `set_up()` rather
than vice versa.
You can test this easily enough by adding a `set_up()` to some test in
5.8. You'll find it never gets called.
Probably the best solution would have been to just do like is in trunk
after https://core.trac.wordpress.org/changeset/51561, let the polyfill
library handle it (and make sure nothing forgets to call `parent::setUp()`
and such, of course). But if you don't want to use the polyfill library
directly for that for some reason (or in 5.1 and earlier where the
polyfill library can't be loaded), you'd want to more or less copy how
it's done in https://github.com/Yoast/PHPUnit-
Polyfills/blob/develop/src/TestCases/TestCasePHPUnitLte7.php into a
`PHPUnit_Adapter_TestCase`.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/53911#comment:41>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list