Skip to content

Add unit tests for heartbeat_autosave() in wp-admin/includes/misc.php#11762

Open
pbearne wants to merge 3 commits intoWordPress:trunkfrom
pbearne:65201-misc-heartbeat_autosave
Open

Add unit tests for heartbeat_autosave() in wp-admin/includes/misc.php#11762
pbearne wants to merge 3 commits intoWordPress:trunkfrom
pbearne:65201-misc-heartbeat_autosave

Conversation

@pbearne
Copy link
Copy Markdown

@pbearne pbearne commented May 7, 2026

Description:
This PR adds unit tests for the heartbeat_autosave() function in wp-admin/includes/misc.php. These tests ensure that the function correctly processes Heartbeat data to trigger post autosaves, and returns the appropriate response messages for success, error, and empty states.

The tests cover:

  • Verification that the response remains unchanged if no wp_autosave data is provided.
  • Successful autosave with correct success message and date format.
  • Handling of WP_Error returned by wp_autosave().
  • Handling of empty results (e.g., when content/title are empty).

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

AI Disclosure:

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @pbearne@git.wordpress.org.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

Core Committers: Use this line as a base for the props when committing in SVN:

Props pbearne.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant