test(account): stub do_action in the account settings harness

The email-change flow fires jio_user_email_changed after a successful
write, but the harness only shimmed add_action, so the run died on an
undefined do_action() before reaching the assertions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-11-11 14:53:09 +08:00
1 parent 024ecddfed
commit 376827ea97
1 file changed
+5
@@ -12,6 +12,7 @@ namespace {
$GLOBALS['jio_account_meta'] = []; $GLOBALS['jio_account_meta'] = [];
$GLOBALS['jio_account_transients'] = []; $GLOBALS['jio_account_transients'] = [];
$GLOBALS['jio_account_actions'] = []; $GLOBALS['jio_account_actions'] = [];
$GLOBALS['jio_account_actions_fired'] = [];
$GLOBALS['jio_account_mail'] = []; $GLOBALS['jio_account_mail'] = [];
$GLOBALS['jio_account_existing_emails'] = []; $GLOBALS['jio_account_existing_emails'] = [];
$GLOBALS['jio_account_captcha_calls'] = []; $GLOBALS['jio_account_captcha_calls'] = [];
@@ -45,6 +46,10 @@ namespace {
function add_action(string $hook, callable $callback): void { function add_action(string $hook, callable $callback): void {
$GLOBALS['jio_account_actions'][$hook] = $callback; $GLOBALS['jio_account_actions'][$hook] = $callback;
} }
/** jQuery-free stub: record fired hooks so tests can assert side effects. */
function do_action(string $hook, mixed ...$args): void {
$GLOBALS['jio_account_actions_fired'][] = ['hook' => $hook, 'args' => $args];
}
function __(string $text, string $domain = ''): string { return $text; } function __(string $text, string $domain = ''): string { return $text; }
function is_wp_error(mixed $value): bool { return $value instanceof WP_Error; } function is_wp_error(mixed $value): bool { return $value instanceof WP_Error; }
function is_email(string $email): bool { return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); } function is_email(string $email): bool { return (bool) filter_var($email, FILTER_VALIDATE_EMAIL); }