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

WordPress Trac noreply at wordpress.org
Mon Jun 16 22:18:30 UTC 2014


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

Comment (by mnelson4):

 Good point @nacin. I actually also backed-up $merged_filters and
 $wp_current_filter.

 @jorbin ya using phpunit's backupGlobals config option might be a good
 idea. And even if there are any legitimate uses of globals that SHOULD NOT
 be reset between each test, those can probably be overcome by
 [http://phpunit.de/manual/current/en/fixtures.html blacklisting] them, and
 using the annotations like you linked to.

 I wonder what the issues were about why we'd want to avoid backing up
 globals? It sounds even better than what I've done because other globals
 wouldn't be carrying over from one test to the next...

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


More information about the wp-trac mailing list