Make WordPress Core

Opened 4 weeks ago

Last modified 4 weeks ago

#65236 new enhancement

Tests: Add unit tests for wp_ajax_nopriv_heartbeat()

Reported by: pbearne's profile pbearne Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch has-unit-tests
Focuses: tests Cc:

Description

This ticket aims to add comprehensive unit test coverage for the wp_ajax_nopriv_heartbeat() function in src/wp-admin/includes/ajax-actions.php, which handles Heartbeat API requests in a no-privilege (logged-out) context.

Change History (1)

This ticket was mentioned in PR #11826 on WordPress/wordpress-develop by @pbearne.


4 weeks ago
#1

  • Keywords has-patch has-unit-tests added

This PR adds comprehensive unit test coverage for the wp_ajax_nopriv_heartbeat() function in src/wp-admin/includes/ajax-actions.php. These tests cover the Heartbeat API in a no-privilege (logged-out) context, including verification of:

  • The base response containing server_time.
  • The heartbeat_nopriv_received filter.
  • The heartbeat_nopriv_send filter.
  • The heartbeat_nopriv_tick action.

Trac ticket: https://core.trac.wordpress.org/ticket/65236

AI Disclosure:

  • AI assistance: Yes
  • Tool(s): Junie (JetBrains)
  • Model(s): gemini-3-flash-preview
  • Used for: Code analysis, test implementation, and workflow management.
Note: See TracTickets for help on using tickets.