Add Behat scenarios for wp cli update --stable / --nightly PHP version checks - #1093
Conversation
…annel manifest requires_php
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds CLI feature scenarios verifying that stable and nightly updates fail when their manifests require an unavailable PHP version. ChangesUpdate gating validation
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds Behat acceptance coverage in wp-cli-bundle to ensure WP-CLI Phar self-updates (wp cli update --stable / --nightly) abort early when the build-channel manifest declares a higher minimum PHP version than the current runtime.
Changes:
- Added a Behat scenario for stable-channel updates that stubs
wp-cli.manifest.jsonwith an unreachablerequires_phpand asserts an early failure. - Added a parallel Behat scenario for nightly-channel updates that stubs
wp-cli-nightly.manifest.jsonwith an unreachablerequires_phpand asserts an early failure.
Suppressed comments (1)
features/cli.feature:215
- Same as the stable scenario: this only checks the required PHP version sentence, but not that the error reports the current PHP version. Adding a second assertion for the "You are currently running PHP" portion better locks in the intended user-facing message.
Then STDERR should contain:
"""
The requested update requires PHP 99.0.0 or higher.
"""
And the return code should be 1
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Then STDERR should contain: | ||
| """ | ||
| The requested update requires PHP 99.0.0 or higher. | ||
| """ | ||
| And the return code should be 1 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Accompanying test suite update for wp-cli/wp-cli#6362, which gates
wp cli update --stableandwp cli update --nightlyon the minimum PHP version specified in the build channel manifest files (wp-cli.manifest.jsonandwp-cli-nightly.manifest.json).These scenarios ensure that WP-CLI Phar self-updates abort early with a descriptive error message when a user's PHP version does not meet the manifest requirement, preventing broken Phar updates during PHP version floor bumps.
Changes
Added two new Behat scenarios to
features/cli.feature:Prevent stable update when PHP version requirement is not met: Stubs an HTTP response forwp-cli.manifest.jsonwith"requires_php": "99.0.0"and verifies that{PHAR_PATH} cli update --stable --yesexits with status 1 and reports the requirement.Prevent nightly update when PHP version requirement is not met: Stubs an HTTP response forwp-cli-nightly.manifest.jsonwith"requires_php": "99.0.0"and verifies that{PHAR_PATH} cli update --nightly --yesexits with status 1 and reports the requirement.Summary by CodeRabbit