[wp-trac] [WordPress Trac] #37207: Multiple unit tests for add_rewrite_endpoint lose custom endpoints

WordPress Trac noreply at wordpress.org
Fri Aug 19 16:16:48 UTC 2016


#37207: Multiple unit tests for add_rewrite_endpoint lose custom endpoints
------------------------------+-----------------------------
 Reporter:  ericdaams         |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  Future Release
Component:  Build/Test Tools  |     Version:  4.5.3
 Severity:  normal            |  Resolution:
 Keywords:  needs-patch       |     Focuses:
------------------------------+-----------------------------

Comment (by boonebgorges):

 @mboynes Thanks for the patch. I'm looking it over in more detail, and now
 I wonder whether it's the right approach.

 Consider post types, taxonomies, and post statuses. In each case, it's
 common practice for plugins to register these object types on `init`. In
 #29827, we toyed with a couple different solutions, and it turned out to
 introduce weird leakage bugs if we tried to back up and then restore
 global data like this. So we went with [29869], which basically says: when
 running the *core* tests, the post_type/taxonomy/post_status slate should
 be wiped clean between tests, but these globals should not be touched
 between tests when `WP_UnitTestCase` is called by a plugin.

 I'm not certain that this setup is the "best" in any meaningful sense, but
 it seems like a compromise that's worked for us. Could we consider
 something similar here? Roughly: the backup/reset process would only
 happen if `! WP_RUN_CORE_TEST`. @mboynes @ericdaams What do you think?

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


More information about the wp-trac mailing list