Skip to content

Add Behat scenarios for wp cli update --stable / --nightly PHP version checks - #1093

Merged
swissspidy merged 3 commits into
mainfrom
fix/update-manifest-check
Aug 3, 2026
Merged

Add Behat scenarios for wp cli update --stable / --nightly PHP version checks#1093
swissspidy merged 3 commits into
mainfrom
fix/update-manifest-check

Conversation

@swissspidy

@swissspidy swissspidy commented Jul 28, 2026

Copy link
Copy Markdown
Member

Accompanying test suite update for wp-cli/wp-cli#6362, which gates wp cli update --stable and wp cli update --nightly on the minimum PHP version specified in the build channel manifest files (wp-cli.manifest.json and wp-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 for wp-cli.manifest.json with "requires_php": "99.0.0" and verifies that {PHAR_PATH} cli update --stable --yes exits with status 1 and reports the requirement.
  • Prevent nightly update when PHP version requirement is not met: Stubs an HTTP response for wp-cli-nightly.manifest.json with "requires_php": "99.0.0" and verifies that {PHAR_PATH} cli update --nightly --yes exits with status 1 and reports the requirement.

Summary by CodeRabbit

  • Bug Fixes
    • CLI updates now stop safely when the selected stable or nightly release requires an unsupported PHP version.
    • Clear error messages are shown instead of proceeding with an incompatible update.

@swissspidy
swissspidy requested a review from a team as a code owner July 28, 2026 09:40
@swissspidy swissspidy added the scope:testing Related to testing label Jul 28, 2026
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: c92aa6bd-e8ae-4050-a917-eeca029ea38f

📥 Commits

Reviewing files that changed from the base of the PR and between 5315443 and 0da3cc6.

📒 Files selected for processing (1)
  • features/cli.feature

📝 Walkthrough

Walkthrough

Adds CLI feature scenarios verifying that stable and nightly updates fail when their manifests require an unavailable PHP version.

Changes

Update gating validation

Layer / File(s) Summary
Stable and nightly PHP requirement scenarios
features/cli.feature
Mocks stable and nightly manifests requiring PHP 99.0.0, then verifies the expected STDERR message and exit code 1 for both update commands.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested reviewers: brianhenryie, ernilambar, janw-me

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the added Behat scenarios covering PHP version checks for stable and nightly update flows.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/update-manifest-check

Comment @coderabbitai help to get the list of available commands.

Copilot AI review requested due to automatic review settings August 3, 2026 08:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.json with an unreachable requires_php and asserts an early failure.
  • Added a parallel Behat scenario for nightly-channel updates that stubs wp-cli-nightly.manifest.json with an unreachable requires_php and 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.

Comment thread features/cli.feature
Comment on lines +191 to +195
Then STDERR should contain:
"""
The requested update requires PHP 99.0.0 or higher.
"""
And the return code should be 1
@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy
swissspidy merged commit 04d986e into main Aug 3, 2026
66 checks passed
@swissspidy
swissspidy deleted the fix/update-manifest-check branch August 3, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants