Skip to content

Stabilize Windows Behat failures in scaffold package/readme scenarios#294

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/fix-behat-test-failure
Draft

Stabilize Windows Behat failures in scaffold package/readme scenarios#294
Copilot wants to merge 4 commits into
mainfrom
copilot/fix-behat-test-failure

Conversation

Copilot AI commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

The failing Windows Behat job was caused by two separate issues:

  1. README scenarios relying on live remote content for support-body rendering.
  2. Windows path handling for --dir values expanded from ~/... with HOME set to an absolute Windows path.

This PR stabilizes both paths while keeping the test intent focused.

  • Scope of change

    • Updated two scaffold package-readme scenarios in features/scaffold-package-readme.feature to:
      • create a minimal foo/composer.json fixture with the desired wp-cli/wp-cli requirement
      • run wp scaffold package-readme foo directly
    • Adjusted expected composer.json assertions in those scenarios to match fixture-based input/output.
    • Added HTTP response mocking for remote support-body README scenarios so they no longer depend on live network content.
    • Fixed Windows absolute-path detection in src/ScaffoldPackageCommand.php so backslash-based paths (e.g. C:\...) are correctly treated as absolute and not incorrectly prefixed with cwd.
  • Why this resolves the failure

    • These README scenarios are intended to validate README/composer version messaging behavior, not full package scaffolding or package-loading behavior.
    • Using direct package-readme fixtures removes fragile package-loading behavior from those tests.
    • Mocking remote response bodies removes network/content volatility from README support-body scenarios.
    • Correct Windows absolute-path detection fixes tilde/HOME scaffold path failures on Windows.
  • Targeted scenario update (example)

    - When I run `wp scaffold package wp-cli/foo --dir=foo --require_wp_cli='>=0.24.0-alpha' --skip-install`
    + And a foo/composer.json file:
    +   """
    +   {
    +       "name": "wp-cli/foo",
    +       "require": {
    +           "wp-cli/wp-cli": ">=0.24.0-alpha"
    +       }
    +   }
    +   """
    + When I run `wp scaffold package-readme foo`

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing Behat test job in GitHub Actions Stabilize README Behat scenarios on Windows by avoiding package install side effects Jun 9, 2026
Copilot AI requested a review from swissspidy June 9, 2026 11:42
@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

Copilot AI changed the title Stabilize README Behat scenarios on Windows by avoiding package install side effects Stabilize README Behat scenarios on Windows by using package-readme fixtures Jun 9, 2026
@swissspidy

This comment was marked as resolved.

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

Copilot AI changed the title Stabilize README Behat scenarios on Windows by using package-readme fixtures Stabilize Windows Behat failures in scaffold package/readme scenarios Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants