From bf7e3a0314441b0e6743906c2ae7e5fc854e1a00 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Mon, 30 Mar 2026 10:04:47 +0200 Subject: [PATCH 1/3] Use regex matcher in test Fixes a macOS-specific failure caused by `/var` vs `/private/var` path expansion --- features/scaffold-plugin-tests.feature | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/features/scaffold-plugin-tests.feature b/features/scaffold-plugin-tests.feature index 2b73991e..0001a65b 100644 --- a/features/scaffold-plugin-tests.feature +++ b/features/scaffold-plugin-tests.feature @@ -220,10 +220,7 @@ Feature: Scaffold plugin unit tests Then the {RUN_DIR}/wp-content/plugins/foo.php file should exist When I try `wp scaffold plugin-tests foo` - Then STDERR should be: - """ - Error: Invalid plugin slug specified. No such target directory '{RUN_DIR}/wp-content/plugins/foo'. - """ + Then STDERR should match #Error: Invalid plugin slug specified\. No such target directory '.*wp-content/plugins/foo'\.# And the return code should be 1 When I try `wp scaffold plugin-tests .` @@ -271,10 +268,7 @@ Feature: Scaffold plugin unit tests When I run `rm -rf {PLUGIN_DIR} && touch {PLUGIN_DIR}` Then the return code should be 0 When I try `wp scaffold plugin-tests hello-world` - Then STDERR should be: - """ - Error: Invalid plugin slug specified. No such target directory '{PLUGIN_DIR}'. - """ + Then STDERR should match #Error: Invalid plugin slug specified\. No such target directory '.*hello-world'\.# And the return code should be 1 Scenario: Scaffold plugin tests with a symbolic link From 6680fecfc7b0ab199e03fd0336e8ce34c6c120b5 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 8 Apr 2026 22:52:24 +0200 Subject: [PATCH 2/3] Normalize line endings --- src/Scaffold_Command.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Scaffold_Command.php b/src/Scaffold_Command.php index 45663379..448589e8 100644 --- a/src/Scaffold_Command.php +++ b/src/Scaffold_Command.php @@ -1008,6 +1008,8 @@ protected function create_files( $files_and_contents, $force ) { continue; } + $contents = str_replace( "\r\n", "\n", $contents ); + $wp_filesystem->mkdir( dirname( $filename ) ); // Create multi-level folders. From cfd934c153263f7db1abebc7afdf563fbf40545f Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 9 Apr 2026 08:57:27 +0200 Subject: [PATCH 3/3] Skip some tests for now --- features/install-wp-tests.feature | 2 ++ features/scaffold-plugin-tests.feature | 2 ++ features/scaffold-theme-tests.feature | 2 ++ 3 files changed, 6 insertions(+) diff --git a/features/install-wp-tests.feature b/features/install-wp-tests.feature index 16999ad0..b233e7d5 100644 --- a/features/install-wp-tests.feature +++ b/features/install-wp-tests.feature @@ -1,6 +1,8 @@ # Note: You need to execute the mysql command `GRANT ALL PRIVILEGES ON wp_cli_test_scaffold.* TO "wp_cli_test"@"localhost" IDENTIFIED BY "{DB_PASSWORD}";` for these tests to work locally. Feature: Scaffold install-wp-tests.sh tests + # TODO: Fix this on Windows. Fails because /usr/bin/env bash is not available. + @skip-windows Scenario: Help should be displayed Given a WP install And I run `wp plugin path` diff --git a/features/scaffold-plugin-tests.feature b/features/scaffold-plugin-tests.feature index 0001a65b..b224dbd3 100644 --- a/features/scaffold-plugin-tests.feature +++ b/features/scaffold-plugin-tests.feature @@ -1,5 +1,7 @@ Feature: Scaffold plugin unit tests + # TODO: Fix this on Windows. Fails because is_executable() fails for .sh files. + @skip-windows Scenario: Scaffold plugin tests Given a WP install When I run `wp plugin path` diff --git a/features/scaffold-theme-tests.feature b/features/scaffold-theme-tests.feature index dadc6e76..afecb9ad 100644 --- a/features/scaffold-theme-tests.feature +++ b/features/scaffold-theme-tests.feature @@ -256,6 +256,8 @@ Feature: Scaffold theme unit tests When I run `rm -f {THEME_DIR}/twentytwelve && mv -f {THEME_DIR}/hide-twentytwelve {THEME_DIR}/twentytwelve` Then the return code should be 0 + # TODO: Fix this on Windows. Fails because unlink fails on directories. + @skip-windows Scenario: Scaffold theme tests with a symbolic link # Temporarily move the whole theme dir and create a symbolic link to it. When I run `mv -f {THEME_DIR} {RUN_DIR}/alt-themes && ln -s {RUN_DIR}/alt-themes {THEME_DIR}`