Skip to content

Flush dynamically scheduled core cron events in Behat tests#148

Merged
swissspidy merged 1 commit into
mainfrom
fix/69-tests
Jul 20, 2026
Merged

Flush dynamically scheduled core cron events in Behat tests#148
swissspidy merged 1 commit into
mainfrom
fix/69-tests

Conversation

@swissspidy

@swissspidy swissspidy commented Jul 20, 2026

Copy link
Copy Markdown
Member

Description

In WordPress 6.3.0+, WordPress core introduced the wp_delete_temp_updater_backups cron hook. This hook is dynamically scheduled for time() (now) when WP_Upgrader is first instantiated on a site (which occurs when wp_version_check executes and finds update/translation offers from api.wordpress.org).

During wp cron event run --all on fresh installs, wp_delete_temp_updater_backups is scheduled mid-execution and is not included in the initial snapshot of events executed by run --all. As a result, it remains queued as due now, causing subsequent wp cron event run --due-now assertions in Behat tests to fail when they expect 0 due events.

This PR adds a wp cron event run --due-now step to flush any dynamically scheduled core cron events before asserting 0 due events.

This makes the tests more resilient as they were temporarily failing because wp-cli/wp-cli-tests#337 wasn't merged yet after the most recent minor release.

Summary by CodeRabbit

  • Bug Fixes
    • Updated cron event execution messaging to reflect newer WordPress behavior.
    • Improved validation of --due-now results by accepting successful execution totals instead of requiring an exact zero-event message.

@coderabbitai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@codecov

codecov Bot commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy added this to the 2.3.11 milestone Jul 20, 2026
@swissspidy
swissspidy merged commit 0a76a38 into main Jul 20, 2026
121 of 122 checks passed
@swissspidy
swissspidy deleted the fix/69-tests branch July 20, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant