[wp-trac] [WordPress Trac] #14994: Introduce a way to identify a hook in progress

WordPress Trac noreply at wordpress.org
Fri Jan 31 20:00:17 UTC 2014


#14994: Introduce a way to identify a hook in progress
-----------------------------------------------+------------------
 Reporter:  nacin                              |       Owner:
     Type:  enhancement                        |      Status:  new
 Priority:  normal                             |   Milestone:  3.9
Component:  Plugins                            |     Version:
 Severity:  normal                             |  Resolution:
 Keywords:  has-patch commit needs-unit-tests  |     Focuses:
-----------------------------------------------+------------------
Changes (by Denis-de-Bernardy):

 * keywords:  has-patch commit has-unit-tests => has-patch commit needs-
     unit-tests


Comment:

 Replying to [comment:12 nacin]:
 > Cool :-)

 *Cough*. No…

 I hate to be the one highlighting this, but the unit tests are less than
 useless. They're literally testing trivial calls to php's built-in `[]=`,
 `empty()` and `in_array()`.

 If you insist on getting unit tests for this, at least mandate proper
 tests that actually use the relevant WP API, instead of sidestepping it
 and populating an array in case the internals change:

 1. call `add_filter()`, twice.
 2. `apply_filter()` on the hook
 3. Assert, *within the filter* as it is being called (or not), that the
 two hooks are called (or not).

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


More information about the wp-trac mailing list