[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
Fri Aug 20 23:11:55 UTC 2021


#53911: Test modernization backwards-compatibility backports to help security test
backports and extenders with WordPress cross-version testing
-----------------------------------+--------------------------
 Reporter:  hellofromTonya         |       Owner:  johnbillion
     Type:  task (blessed)         |      Status:  assigned
 Priority:  normal                 |   Milestone:  5.9
Component:  Build/Test Tools       |     Version:
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |     Focuses:
-----------------------------------+--------------------------

Comment (by jrf):

 Replying to [comment:18 azaozz]:
 > Great, thanks for the explanation. Guessing that if there's a way to not
 load the polyfills when using latest PHPUnit, that will be backported to
 WP 5.2 - 5.8 too.

 As this ticket is about the **''backports''**, the polyfills are needed as
 the tests on WP < 5.9 will **never** run on the latest PHPUnit, but always
 on older, outdated PHPUnit versions.

 The polyfills being available means, that those security tests I mentioned
 earlier, can still be backported to older WP versions without needing to
 adapt them to those older, outdated PHPUnit versions, even when they use
 PHPUnit 9.x assertions/expectation methods.

 As for WP 5.9 - which is outside the scope of this ticket -, as
 @SergeyBiryukov correctly points out, the polyfills are also used when
 running the latest PHPUnit version (9.5.x) as they solve the `void`
 conundrum via the `snake_case` fixture methods.

 The functionality from the polyfills is lightweight and only those
 polyfills which are actually needed on any particular PHPUnit version are
 loaded. When the functionality is not needed, an empty trait is loaded and
 the assertions/expectations will just fall through to the PHPUnit native
 functionality.

 I invite you to have a good look at the code in the
 [https://github.com/Yoast/PHPUnit-Polyfills Polyfill repo], including the
 autoload mechanism and you will see what I mean.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53911#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list