[wp-trac] [WordPress Trac] #28535: WP Unit Tests should reset hooks after each test

WordPress Trac noreply at wordpress.org
Wed Aug 13 17:35:53 UTC 2014


#28535: WP Unit Tests should reset hooks after each test
------------------------------+-----------------------------
 Reporter:  mnelson4          |       Owner:  wonderboymusic
     Type:  enhancement       |      Status:  reopened
 Priority:  normal            |   Milestone:  4.0
Component:  Build/Test Tools  |     Version:  trunk
 Severity:  normal            |  Resolution:
 Keywords:  needs-patch       |     Focuses:
------------------------------+-----------------------------

Comment (by wonderboymusic):

 There are 2 conventions for removing filters in WP unit tests:

 1. on `->tearDown()`
 2. when the filter callback is invoked, the first line of the callback
 immediately removes it

 There is no precedent for using `__destruct()` in the WordPress suite, so
 it's only a BuddyPress suite regression. Because it causes issues in 5.2.x
 only, why not standardize on not using `__destruct()` and call it a day?

 Our only other option is to introduce more globals to store the values,
 which I view as a worse solution.

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


More information about the wp-trac mailing list