Make WordPress Core

Opened 5 weeks ago

Closed 5 weeks ago

#65200 closed enhancement (fixed)

Tests: Add unit tests for wp_heartbeat_set_suspension()

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_heartbeat_set_suspension() function in wp-admin/includes/misc.php. The tests will verify that the function correctly modifies the Heartbeat settings to disable suspension when on post.php or post-new.php, and leaves them unchanged otherwise.

Change History (3)

This ticket was mentioned in PR #11761 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_heartbeat_set_suspension() function in wp-admin/includes/misc.php. This function is responsible for disabling the suspension of Heartbeat on the Add/Edit Post screens to ensure consistent behavior during content creation.

The tests cover:

  • Disabling suspension when the $pagenow global is post.php.
  • Disabling suspension when the $pagenow global is post-new.php.
  • Ensuring suspension settings remain unchanged on other screens (e.g., index.php, edit.php).

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

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
5 weeks ago

  • Milestone changed from Awaiting Review to 7.1

#3 @SergeyBiryukov
5 weeks ago

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

In 62351:

Tests: Add unit tests for wp_heartbeat_set_suspension().

Follow-up to [26428], [26549].

Props pbearne.
Fixes #65200.

Note: See TracTickets for help on using tickets.