Skip to content

Conversation

@swissspidy
Copy link
Member

@swissspidy swissspidy commented Oct 2, 2025

I'm trying to improve Windows support a little bit so that tests could run on CI. Doing things in PHP vs. CLI commands is one step.

Lots of AI code changes in here, might need some cleanup

Main change is blocked by wp-cli/wp-cli#6124

To-do:

  • Add Behat tags to skip tests for certain OS?

See #155

@swissspidy swissspidy requested a review from a team October 12, 2025 18:31
@swissspidy swissspidy marked this pull request as ready for review October 12, 2025 18:31
Copy link

Copilot AI left a comment

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 improves Windows compatibility for the WP-CLI test framework by replacing shell commands with PHP native functions where possible, ensuring cross-platform path handling, and adding Windows-specific code paths.

Key changes:

  • Replaced grep and exec commands with PHP glob(), file_get_contents(), and preg_match_all() for parsing Behat feature tags
  • Replaced curl commands with Utils\http_request() for downloading files
  • Replaced rm -rf and cp -r commands with PHP's RecursiveIteratorIterator for directory operations
  • Added Windows-specific handling for process management, path separators, and executable detection

Reviewed Changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 17 comments.

Show a summary per file
File Description
utils/behat-tags.php Replaced shell grep commands with PHP file operations and regex matching for cross-platform tag parsing
tests/tests/TestBehatTags.php Added remove_dir() helper and run_behat_tags_script() method with Windows-specific command building
src/Context/GivenStepDefinitions.php Replaced curl command with Utils\http_request() for file downloads
src/Context/FeatureContext.php Extensive changes including Windows binary detection (wp.bat), process termination, directory operations, and environment variable handling
phpunit.xml.dist Removed unused test directory specification
phpstan.neon.dist Removed ignoreErrors entry that is no longer needed
features/testing.feature Updated test to verify new DISABLE_WP_CRON constant check format
features/steps.feature Updated regex to match both wp and wp.bat in output
composer.json Updated wp-cli/wp-cli dependency from ^2.12 to ^2.13
bin/install-package-tests Fixed spelling of "Prompt" and corrected color code format
.github/workflows/testing.yml Added test matrix entries for macOS and Windows with MySQL and SQLite configurations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

3 participants