test: cover cleanup without presence table - #263
Conversation
Fixes WordPress#262 Assisted-by: OpenAI Codex
|
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 Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @floze-the-genius. 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: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #263 +/- ##
============================================
+ Coverage 77.55% 77.65% +0.10%
Complexity 178 178
============================================
Files 14 14
Lines 1974 1974
============================================
+ Hits 1531 1533 +2
+ Misses 443 441 -2
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Hey @floze-the-genius thanks for tackling this.
To receive proper attribution please associate a WordPress.org account with your GitHub account. Let me know once that's setup and I'll run the props-bot again. |
| public function test_cleanup_reports_zero_without_a_table() { | ||
| add_filter( 'option_wp_presence_db_version', '__return_zero' ); | ||
|
|
||
| $this->command->cleanup( array(), array( 'yes' => true ) ); |
There was a problem hiding this comment.
The confirm assertion here doesn't actually test the no-table code path.
cleanup() skips confirm() for two reasons - either the table is missing, or 'yes' => true was passed. This test passes 'yes' => true, so confirm() is already skipped, regardless of whether the no-table path fires. I confirmed this by removing the no-table early return from cleanup() and rerunning. It still passed.
The "yes flag skips confirm" behavior is already covered here test_cleanup_skips_the_prompt_with_the_yes_flag .
| $this->command->cleanup( array(), array( 'yes' => true ) ); | |
| $this->command->cleanup( array(), array() ); |
Adds regression coverage for the
cleanup()early return when the presence table is unavailable. The test uses the established database-version filter pattern and verifies both the zero-deletion success message and that no confirmation prompt is shown.Fixes #262
Testing
git diff --checkThe new cleanup case also passes in multisite mode. The complete local multisite run has one unrelated failure in
test_new_site_is_provisioned_on_initialize_site; it reproduces when run alone, and both that test and its production path are unchanged frommain. The authoritative hosted PHP 8.3 multisite job passes.The hosted Playwright job did not reach E2E tests because
wp-env startencountered a runner/network TLS hostname mismatch while Composer fetched a dependency. The equivalent local Playwright suite passes all 13 tests.Use of AI Tools
AI assistance: Yes
Tool(s): OpenAI Codex
Model(s): GPT-5
Used for: Drafting the issue-prescribed regression test and validation notes, running the relevant project gates, and an additional AI-assisted review. Human maintainer review remains required.