Skip to content

Tests: improve Windows compatibility#217

Draft
swissspidy wants to merge 1 commit intomainfrom
fix/windows-tests
Draft

Tests: improve Windows compatibility#217
swissspidy wants to merge 1 commit intomainfrom
fix/windows-tests

Conversation

@swissspidy
Copy link
Copy Markdown
Member

No description provided.

@github-actions
Copy link
Copy Markdown
Contributor

Hello! 👋

Thanks for opening this pull request! Please check out our contributing guidelines. We appreciate you taking the initiative to contribute to this project.

Contributing isn't limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.

Here are some useful Composer commands to get you started:

  • composer install: Install dependencies.
  • composer test: Run the full test suite.
  • composer phpcs: Check for code style violations.
  • composer phpcbf: Automatically fix code style violations.
  • composer phpunit: Run unit tests.
  • composer behat: Run behavior-driven tests.

To run a single Behat test, you can use the following command:

# Run all tests in a single file
composer behat features/some-feature.feature

# Run only a specific scenario (where 123 is the line number of the "Scenario:" title)
composer behat features/some-feature.feature:123

You can find a list of all available Behat steps in our handbook.

@github-actions github-actions bot added the scope:testing Related to testing label Mar 27, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates Behat feature files to improve cross-platform compatibility by replacing /dev/null with a temporary file and switching from single to double quotes in shell commands. However, the use of double quotes for the password argument in features/config-create.feature introduces a regression on POSIX-compliant systems because the shell will interpret the backslash escape sequences differently than on Windows.

And WP files

When I run `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass='my\\password'`
When I run `wp config create --skip-check --dbname=somedb --dbuser=someuser --dbpass="my\\password"`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

This change to use double-quotes, while beneficial for Windows compatibility elsewhere, introduces a regression for this specific test case on POSIX-compliant systems like Linux and macOS.

  • On Windows cmd.exe, "my\\password" is passed to the program as the string my\\password.
  • On POSIX shells (e.g., bash), "my\\password" is interpreted as my\password because the shell processes the \\ escape sequence.

This difference in shell behavior will cause this test to fail in non-Windows environments, as the test expects the password argument to be my\\password.

Please find a cross-platform compatible way to quote this argument. This can be tricky due to shell differences. An alternative could be to adjust the test itself to use a password that doesn't have this ambiguity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant