Make WordPress Core

Opened 5 weeks ago

Closed 4 weeks ago

#65199 closed enhancement (fixed)

Tests: Add unit tests for wp_refresh_heartbeat_nonces()

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

Description

This ticket adds unit tests for the wp_refresh_heartbeat_nonces() function in wp-admin/includes/misc.php. These tests will verify that the function correctly refreshes the Heartbeat nonce and returns it in the response data.

Change History (3)

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


5 weeks ago
#1

  • Keywords has-patch has-unit-tests added

…/misc.php
Description:
This PR adds unit tests for the wp_refresh_heartbeat_nonces() function in wp-admin/includes/misc.php. This function is responsible for adding refreshed REST API and Heartbeat nonces to the response sent back during Heartbeat requests.

The tests cover:

  • Successful addition of rest_nonce and heartbeat_nonce to an existing response array.
  • Verification that existing data in the response is preserved.
  • Verification that if the nonces already exist in the response, they are correctly overwritten with new, valid nonces.

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

AI Disclosure:

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

#2 @SergeyBiryukov
4 weeks ago

  • Milestone changed from Awaiting Review to 7.1

#3 @SergeyBiryukov
4 weeks ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 62356:

Tests: Add unit tests for wp_refresh_heartbeat_nonces().

Follow-up to [44275].

Props pbearne.
Fixes #65199.

Note: See TracTickets for help on using tickets.