Skip to content

Tests: improve Windows compatibility#72

Merged
swissspidy merged 1 commit intomainfrom
fix/windows-tests
Mar 28, 2026
Merged

Tests: improve Windows compatibility#72
swissspidy merged 1 commit intomainfrom
fix/windows-tests

Conversation

@swissspidy
Copy link
Copy Markdown
Member

No description provided.

@swissspidy swissspidy added this to the 2.0.18 milestone Mar 28, 2026
@swissspidy swissspidy requested a review from a team as a code owner March 28, 2026 11:55
Copilot AI review requested due to automatic review settings March 28, 2026 11:55
@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 help-wanted Extra attention is needed scope:testing Related to testing labels Mar 28, 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 the super-admin.feature test file to use wp eval-file with a temporary PHP script instead of an inline wp eval command for user deletion. The review feedback suggests adopting short array syntax [] in the PHP script to comply with modern PHP coding standards.

"""
<?php
global $wpdb;
$wpdb->delete( $wpdb->users, array( 'user_login' => 'admin2' ) );
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

To align with modern PHP standards (PSR-12) and for consistency within the project, please use the short array syntax [] instead of array().

      $wpdb->delete( $wpdb->users, [ 'user_login' => 'admin2' ] );
References
  1. The PSR-12 standard is the current recommendation for PHP code style. While it doesn't explicitly forbid array(), the use of short array syntax ([]) is a widely adopted best practice in the modern PHP ecosystem and is often enforced by linters configured for PSR-12. (link)

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

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

Updates the super-admin Behat feature test to avoid inline wp eval quoting issues that can break on Windows shells.

Changes:

  • Replace inline wp eval user deletion with a temporary PHP script + wp eval-file.

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

$wpdb->delete( $wpdb->users, array( 'user_login' => 'admin2' ) );
"""
When I run `wp eval-file delete-user.php`
And I run `wp eval 'wp_cache_flush();'`
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

This step still uses wp eval 'wp_cache_flush();', which relies on single-quote shell parsing and can still fail under Windows shells (cmd.exe/PowerShell). Consider replacing this with a shell-friendly command like wp cache flush (or include the cache flush in the same eval-file script) to fully address Windows compatibility.

Suggested change
And I run `wp eval 'wp_cache_flush();'`
And I run `wp cache flush`

Copilot uses AI. Check for mistakes.
@swissspidy swissspidy merged commit e887cc9 into main Mar 28, 2026
68 checks passed
@swissspidy swissspidy deleted the fix/windows-tests branch March 28, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

help-wanted Extra attention is needed scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants