Repository navigation
Tests: Add unit tests for wp_is_recovery_mode() - #14477
shail-mehta wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The tests cover the helper’s boolean behavior and restore shared state, with no blocking issues identified.
No open issues 🎉
What changed in this PR
Adds dedicated PHPUnit coverage for wp_is_recovery_mode() without changing production code.
Changes:
- Tests inactive and active recovery mode.
- Verifies agreement with the recovery-mode singleton.
- Restores shared state after each test.
| File | Description |
|---|---|
| tests/phpunit/tests/load/wpIsRecoveryMode.php | Adds helper tests with state setup and cleanup. |
Review effort: Balanced
|
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 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. |
| * @param string $property Property name. | ||
| * @return mixed Property value. | ||
| */ | ||
| private function get_recovery_mode_property( $property ) { |
There was a problem hiding this comment.
Optional, and it applies to several PRs in this series (#14482, #14480, #14477, #14476, #14475): each copies the same reflection helpers to read and set the recovery mode state. Also, tear_down() does not need to restore options or hooks. The test framework rolls back the database and restores hooks after each test.
lancewillett
left a comment
There was a problem hiding this comment.
The literal active/inactive cases protect the wrapper’s result, and the singleton state is restored. Optional cleanup: remove test_matches_recovery_mode_singleton_state(); the two literal cases already cover both states with stronger expectations. Mukesh’s shared-helper suggestion can be handled separately.
Unit-tests audit and Copilot review found no blockers. PHPCS passed. Each class passed separately, and the combined batch passed randomized single-site and multisite runs: 63 tests, 95 assertions each (seeds 65829 and 65830). CI is green on the reviewed commit.
AI review · gpt-6
Verify active and inactive recovery-mode results and consistency with the recovery-mode instance. Restore its original state after each test. Developed in: #14477 Props shailu25, mukesh27. See #65819. git-svn-id: https://develop.svn.wordpress.org/trunk@64556 602fd350-edb4-49c9-b593-d223f7449a82
|
PR #14477 landed in https://core.trac.wordpress.org/changeset/64556 |
Verify active and inactive recovery-mode results and consistency with the recovery-mode instance. Restore its original state after each test. Developed in: WordPress/wordpress-develop#14477 Props shailu25, mukesh27. See #65819. Built from https://develop.svn.wordpress.org/trunk@64556 git-svn-id: http://core.svn.wordpress.org/trunk@63706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
What
Trac ticket: #65819
Adds unit tests for
wp_is_recovery_mode()intests/phpunit/tests/load/wpIsRecoveryMode.php.Covers inactive and active recovery mode, and that the helper matches
wp_recovery_mode()->is_active().Test-only change.
Why
This helper has had no dedicated PHPUnit coverage.
How
is_activestatefalsewhen inactive,truewhen activeWP_Recovery_Mode::is_active()Testing instructions
Use of AI Tools