Problem
The managed wordpress.phpunit bootstrap replays deferred init callbacks from a fixed snapshot. When a plugin's early init callback registers callbacks at later init priorities, those callbacks never execute.
Data Machine Events exposes the normal WordPress pattern:
add_action( 'init', [ $plugin, 'init' ], 0 );
// During init():
add_action( 'init', [ $plugin, 'register_blocks' ], 15 );
add_action( 'init', [ $plugin, 'register_taxonomies' ], 20 );
Under a normal WordPress hook dispatch, the priority-15 and priority-20 callbacks run in the same init action. Under WP Codebox managed PHPUnit, did_action( 'init' ) > 0 but the blocks and taxonomies are absent.
The relevant bootstrap path snapshots/defer-replays callbacks in packages/runtime-playground/src/phpunit-command-handlers.ts around the managed bootstrap's pg_run_deferred_wordpress_hook_callbacks(..., 'init') call.
Expected
Managed PHPUnit replay must preserve normal WP_Hook behavior for callbacks added at later priorities during the same action. It must still execute each deferred callback exactly once and must not rerun callbacks WordPress already dispatched.
Acceptance
- Add a fixture callback at
init priority 0 that registers another callback at priority 15.
- Prove both callbacks run once in priority order during managed bootstrap.
- Preserve existing dependency/component
plugins_loaded, abilities, and duplicate-bootstrap guarantees.
- Do not require consumers to preload classes or invoke plugin methods directly.
Discovered while fixing Extra-Chill/data-machine-events#546.
Problem
The managed
wordpress.phpunitbootstrap replays deferredinitcallbacks from a fixed snapshot. When a plugin's earlyinitcallback registers callbacks at laterinitpriorities, those callbacks never execute.Data Machine Events exposes the normal WordPress pattern:
Under a normal WordPress hook dispatch, the priority-15 and priority-20 callbacks run in the same
initaction. Under WP Codebox managed PHPUnit,did_action( 'init' ) > 0but the blocks and taxonomies are absent.The relevant bootstrap path snapshots/defer-replays callbacks in
packages/runtime-playground/src/phpunit-command-handlers.tsaround the managed bootstrap'spg_run_deferred_wordpress_hook_callbacks(..., 'init')call.Expected
Managed PHPUnit replay must preserve normal
WP_Hookbehavior for callbacks added at later priorities during the same action. It must still execute each deferred callback exactly once and must not rerun callbacks WordPress already dispatched.Acceptance
initpriority 0 that registers another callback at priority 15.plugins_loaded, abilities, and duplicate-bootstrap guarantees.Discovered while fixing Extra-Chill/data-machine-events#546.