Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion features/makephp.feature
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ Feature: Generate PHP files from PO files
And STDERR should be empty
And the foo-plugin/foo-plugin-de_DE.l10n.php file should contain:
"""
<?php
return ['domain'=>NULL,'plural-forms'=>'nplurals=2; plural=n != 1;','language'=>'de_DE','project-id-version'=>'Development (5.2.x)','pot-creation-date'=>'','po-revision-date'=>'2019-03-28 19:42+0300','x-generator'=>'Poedit 2.2.1','messages'=>['html_lang_attribute'=>'de-DE','text directionltr'=>'ltr','number_format_decimal_point'=>',','number_format_thousands_sep'=>'.','Update %s now'=>'Jetzt %s aktualisieren','[%1$s] Confirm Action: %2$s'=>'[%1$s] Aktion bestätigen: %2$s','[%s] Erasure Request Fulfilled'=>'[%s] Löschauftrag ausgeführt','[%s] Personal Data Export'=>'[%s] Export personenbezogener Daten']];
Comment on lines 154 to 156
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.

Dropping the <?php line from the expected content makes this assertion much less strict and could let a regression slip through (e.g., missing PHP open tag) just to work around line-ending differences. A more robust approach is to assert <?php and the return [...] payload separately (or use an assertion that’s tolerant of CRLF between lines) so Windows compatibility doesn’t reduce coverage.

Copilot uses AI. Check for mistakes.
"""

Expand Down
31 changes: 27 additions & 4 deletions features/makepot.feature
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Feature: Generate a POT file of a WordPress project
Plugin Description
"""

@skip-windows
Scenario: Adds copyright comments
When I run `wp scaffold plugin hello-world`
And I run `date +"%Y"`
Expand All @@ -112,6 +113,20 @@ Feature: Generate a POT file of a WordPress project
# This file is distributed under the same license as the Hello World plugin.
"""

@require-windows
Scenario: Adds copyright comments
When I run `wp scaffold plugin hello-world`
Comment on lines +116 to +118
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.

There are now two scenarios with the exact same name (one Windows-only, one non-Windows). Even if the runner allows it, it makes test reports and reruns ambiguous. Rename one/both scenarios to include the platform (or avoid duplication entirely) so failures can be identified unambiguously.

Copilot uses AI. Check for mistakes.
And I run `get-date -f yyyy`
Then STDOUT should not be empty
And save STDOUT as {YEAR}
Comment on lines 102 to +121
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.

These tests still rely on platform-specific shell commands to determine the current year (date vs get-date), which duplicates the scenario and can be brittle depending on which shell is used to execute I run on Windows. Consider replacing both with a single cross-platform WP-CLI call (e.g., wp eval emitting date('Y')) so the scenario can run unconditionally without OS-specific tags/duplication.

Copilot uses AI. Check for mistakes.

When I run `wp i18n make-pot wp-content/plugins/hello-world wp-content/plugins/hello-world/languages/hello-world.pot`
Then the wp-content/plugins/hello-world/languages/hello-world.pot file should contain:
"""
# Copyright (C) {YEAR} YOUR NAME HERE
# This file is distributed under the same license as the Hello World plugin.
"""

Scenario: Use the same license as the plugin
Given an empty foo-plugin directory
And a foo-plugin/foo-plugin.php file:
Expand Down Expand Up @@ -1692,6 +1707,8 @@ Feature: Generate a POT file of a WordPress project
msgid "Hello World JS"
"""

# Because of the date command usage.
@skip-windows
Scenario: Uses newer file headers when merging translations
Given an empty foo-plugin directory
And a foo-plugin/foo-plugin.pot file:
Expand Down Expand Up @@ -2637,7 +2654,10 @@ Feature: Generate a POT file of a WordPress project
__( 'Hello World', 'foo-plugin' );
"""

When I try `wp i18n make-pot foo-plugin --debug`
When I run `wp eval "echo DIRECTORY_SEPARATOR;"`
And save STDOUT as {DIRECTORY_SEPARATOR}
Comment thread
swissspidy marked this conversation as resolved.

And I try `wp i18n make-pot foo-plugin --debug`
Then STDOUT should be:
"""
Plugin file detected.
Expand All @@ -2653,7 +2673,7 @@ Feature: Generate a POT file of a WordPress project
"""
And STDERR should contain:
"""
foo-plugin/foo-plugin.php
foo-plugin{DIRECTORY_SEPARATOR}foo-plugin.php
"""
And STDERR should contain:
"""
Expand Down Expand Up @@ -2707,7 +2727,10 @@ Feature: Generate a POT file of a WordPress project
*/
"""

When I try `wp i18n make-pot foo-theme --debug`
When I run `wp eval "echo DIRECTORY_SEPARATOR;"`
And save STDOUT as {DIRECTORY_SEPARATOR}

And I try `wp i18n make-pot foo-theme --debug`
Then STDOUT should be:
"""
Theme stylesheet detected.
Expand All @@ -2723,7 +2746,7 @@ Feature: Generate a POT file of a WordPress project
"""
And STDERR should contain:
"""
foo-theme/style.css
foo-theme{DIRECTORY_SEPARATOR}style.css
"""
And STDERR should contain:
"""
Expand Down
Loading