Skip to content

Commit f3f96bf

Browse files
committed
Fix parallel smoke test: stub do_action for the run-completed hook
workflow-parallel-smoke.php defines its own inline WordPress stubs and had add_filter/apply_filters/add_action but not do_action. The runner now fires do_action( 'wp_agent_workflow_run_completed', ... ) at the terminal funnel, so run() under this stub set hit "Call to undefined function do_action()" and the test fataled (exit 255). Add the missing do_action stub — it dispatches the callbacks registered via the add_action/add_filter stubs — so the completion hook fires in the test the same way it does under WordPress. Production code is unaffected; only the test harness lacked the stub. ## AI assistance - **AI assistance:** Yes - **Tool(s):** Claude Opus 4.8 via Claude Code - **Used for:** Diagnosing the missing-stub CI failure and adding the do_action stub.
1 parent 446733e commit f3f96bf

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

tests/workflow-parallel-smoke.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ function add_action( string $hook, callable $cb, int $priority = 10, int $accept
8787
add_filter( $hook, $cb, $priority, $accepted_args );
8888
}
8989
}
90+
if ( ! function_exists( 'do_action' ) ) {
91+
function do_action( string $hook, ...$args ): void {
92+
$cbs = $GLOBALS['__filters'][ $hook ] ?? array();
93+
ksort( $cbs );
94+
foreach ( $cbs as $bucket ) {
95+
foreach ( $bucket as $cb ) {
96+
call_user_func_array( $cb, $args );
97+
}
98+
}
99+
}
100+
}
90101
if ( ! function_exists( 'wp_get_ability' ) ) {
91102
function wp_get_ability( string $name ) {
92103
return $GLOBALS['__abilities'][ $name ] ?? null;

0 commit comments

Comments
 (0)