Repository navigation
Test uninstall.php on one site and on a network - #180
Conversation
uninstall.php, about a fifth of the plugin's lines, had no test. The new tests load it with wpdb and multisite doubles and cover the single-site removal, the paged network removal, every failure it reports (database unavailable, unreadable or invalid site lists, an option still stored, a site created during removal, switching to or back from a site failing), the at-most-20 list of failed sites, and the stop with wp_die() before WordPress deletes the plugin files. Line coverage of the unit suite rises from about 75% to 96.6%, so the CI floor rises from 72% to 94%. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for contributing to EngineScript Site Optimizer! Before we review:
Security Reminder
We'll review your PR soon. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 49 |
| Duplication | 0 |
🟢 Coverage ∅ diff coverage · +20.96% coverage variation
Metric Results Coverage variation ✅ +20.96% coverage variation (-1.00%) Diff coverage ✅ ∅ diff coverage Coverage variation details
Coverable lines Covered lines Coverage Common ancestor commit (8fba47f) 877 663 75.60% Head commit (dc3e63b) 871 (-6) 841 (+178) 96.56% (+20.96%) Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch:
<coverage of head commit> - <coverage of common ancestor commit>Diff coverage details
Coverable lines Covered lines Diff coverage Pull request (#180) 0 0 ∅ (not applicable) Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified:
<covered lines added or modified>/<coverable lines added or modified> * 100%
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Summary
uninstall.php(186 executable lines) had no test, which left the unit suite at about 75% line coverage.tests/unit/UninstallTest.phploadsuninstall.phpand tests each function:tests/unit/UninstallFailureTest.phpruns the file in a separate process to show that a failed removal stops withwp_die()before WordPress deletes the plugin files.tests/bootstrap.phpgains a scriptablewpdbdouble, the multisite switch functions,wp_cache_supports()andwp_cache_flush_runtime(), and a callback hook ondelete_option().MINIMUM_LINE_COVERAGErises from 72 to 94.Testing
composer check-all, yamllint, actionlint and gitleaks pass.🤖 Generated with Claude Code