Skip to content

test: add coverage for sanitize_checkbox and cleanup guard - #897

Open
hmbashar wants to merge 1 commit into
WordPress:mainfrom
hmbashar:test/sanitize-checkbox-and-cleanup-guard
Open

hmbashar wants to merge 1 commit into
WordPress:mainfrom
hmbashar:test/sanitize-checkbox-and-cleanup-guard

Conversation

@hmbashar

Copy link
Copy Markdown

Fixes #895

Two untested code paths: `wp_presence_sanitize_checkbox()` had no `@covers` tests at all, and the early-return guard in `wp_delete_expired_presence_data()` that fires when a filter sets `batch_size` or `max_passes` below one was unreachable by the existing three cleanup tests (all of which pass values ≥ 1).

Use of AI Tools

AI assistance: Yes
Tool(s): Claude
Model(s): claude-sonnet-4-6
Used for: Test implementation; reviewed and verified by contributor.

wp_presence_sanitize_checkbox() had no @Covers tests; adds cases for
truthy, falsy, and the PHP-falsy string '0' edge case. The early-return
guard in wp_delete_expired_presence_data() that fires when batch_size or
max_passes is filtered to below one was also untested; adds a test that
seeds an expired row, filters batch_size to 0, and asserts the row survives.
@github-actions

Copy link
Copy Markdown
Contributor

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

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

Props hmbashar.

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.56%. Comparing base (2e26f44) to head (ed62692).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #897      +/-   ##
============================================
+ Coverage     97.51%   97.56%   +0.04%     
  Complexity      269      269              
============================================
  Files            30       30              
  Lines          4388     4388              
============================================
+ Hits           4279     4281       +2     
+ Misses          109      107       -2     
Flag Coverage Δ
multisite 97.56% <ø> (+0.04%) ⬆️
phpunit 77.66% <ø> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
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.

wp_presence_sanitize_checkbox() and cleanup guard have no tests

1 participant