From c6697af21dfa12441672d1b3f2ad5dc45237d416 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Sat, 28 Mar 2026 00:03:22 +0100 Subject: [PATCH 1/2] Tests: improve Windows compatibility --- features/makephp.feature | 1 - features/makepot.feature | 27 +++++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/features/makephp.feature b/features/makephp.feature index 66f12711..49967a11 100644 --- a/features/makephp.feature +++ b/features/makephp.feature @@ -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: """ - 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']]; """ diff --git a/features/makepot.feature b/features/makepot.feature index f86d0131..f15cd81a 100644 --- a/features/makepot.feature +++ b/features/makepot.feature @@ -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"` @@ -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` + And I run `get-date –f yyyy` + Then STDOUT should not be empty + And save STDOUT as {YEAR} + + 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: @@ -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: @@ -2637,6 +2654,9 @@ Feature: Generate a POT file of a WordPress project __( 'Hello World', 'foo-plugin' ); """ + When I run `wp eval "echo DIRECTORY_SEPARATOR;"` + And save STDOUT as {DIRECTORY_SEPARATOR} + When I try `wp i18n make-pot foo-plugin --debug` Then STDOUT should be: """ @@ -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: """ @@ -2707,6 +2727,9 @@ Feature: Generate a POT file of a WordPress project */ """ + When I run `wp eval "echo DIRECTORY_SEPARATOR;"` + And save STDOUT as {DIRECTORY_SEPARATOR} + When I try `wp i18n make-pot foo-theme --debug` Then STDOUT should be: """ @@ -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: """ From 2a880a8320cdebb687d381d3ca174d69d6f15dc5 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Sat, 28 Mar 2026 12:53:48 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Pascal Birchler --- features/makepot.feature | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/features/makepot.feature b/features/makepot.feature index f15cd81a..5849cba0 100644 --- a/features/makepot.feature +++ b/features/makepot.feature @@ -116,7 +116,7 @@ Feature: Generate a POT file of a WordPress project @require-windows Scenario: Adds copyright comments When I run `wp scaffold plugin hello-world` - And I run `get-date –f yyyy` + And I run `get-date -f yyyy` Then STDOUT should not be empty And save STDOUT as {YEAR} @@ -2657,7 +2657,7 @@ Feature: Generate a POT file of a WordPress project When I run `wp eval "echo DIRECTORY_SEPARATOR;"` And save STDOUT as {DIRECTORY_SEPARATOR} - When I try `wp i18n make-pot foo-plugin --debug` + And I try `wp i18n make-pot foo-plugin --debug` Then STDOUT should be: """ Plugin file detected. @@ -2730,7 +2730,7 @@ Feature: Generate a POT file of a WordPress project When I run `wp eval "echo DIRECTORY_SEPARATOR;"` And save STDOUT as {DIRECTORY_SEPARATOR} - When I try `wp i18n make-pot foo-theme --debug` + And I try `wp i18n make-pot foo-theme --debug` Then STDOUT should be: """ Theme stylesheet detected.