#60193 closed enhancement (fixed)
Tests: Expand hook priority call order tests
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch has-unit-tests commit |
Focuses: | Cc: |
Description
#30875 identified more tests are needed to further test the call order for various priority data types.
Though add_action()
and add_filter()
priority are documented as int
, there is no enforcement to require only an integer data type. It's highly likely numeric strings are being passed.
What happens if non-numeric data types and types are passed? These would represent the unhappy path datasets.
This ticket proposes adding both happy and unhappy datasets to further document what should happen for the call order when given the priority of different data types and values.
Change History (4)
This ticket was mentioned in PR #5841 on WordPress/wordpress-develop by @hellofromTonya.
14 months ago
#1
- Keywords has-patch has-unit-tests added; needs-unit-tests removed
#2
@
13 months ago
- Keywords commit added
Patch: https://github.com/WordPress/wordpress-develop/pull/5841
The patch is ready for commit.
It adds happy and unhappy path priority callback order tests for:
do_action()
WP_Hook::do_action()
apply_filters()
WP_Hook::apply_filters()
Though these tests may seem redundant, each of these functions have differing code that may impact the results. Thus testing each ensures the expected results and can help to protect against future regressions.
@hellofromTonya commented on PR #5841:
13 months ago
#4
Committed via https://core.trac.wordpress.org/changeset/57257.
Expand the existing tests for hooks priority tests to futher check the call order for happy (numeric priorities) and unhappy (non-numeric priorities) paths.
Trac ticket: https://core.trac.wordpress.org/ticket/60193