Skip to content

Commit 7250425

Browse files
Copilotswissspidy
andcommitted
Add test for PHP binary path with spaces and apply fix to CLI_Command
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent 0d505a4 commit 7250425

File tree

2 files changed

+829
-0
lines changed

2 files changed

+829
-0
lines changed

features/cli.feature

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,27 @@ Feature: `wp cli` tasks
173173
"""
174174
WP-CLI {UPDATE_VERSION}
175175
"""
176+
177+
@github-api
178+
Scenario: Update command works with PHP binary path containing spaces
179+
Given an empty directory
180+
And a new Phar with version "0.0.0"
181+
182+
# Create a directory with spaces and a PHP wrapper
183+
When I run `mkdir -p "php with spaces/bin"`
184+
And I run `printf '#!/bin/bash\nexec php "$@"' > "php with spaces/bin/php"`
185+
And I run `chmod +x "php with spaces/bin/php"`
186+
Then the return code should be 0
187+
188+
# Test that the update command works when PHP_BINARY has spaces
189+
When I run `PHP_BINARY="$PWD/php with spaces/bin/php" "$PWD/php with spaces/bin/php" {PHAR_PATH} cli update --yes`
190+
Then STDOUT should contain:
191+
"""
192+
sha512 hash verified:
193+
"""
194+
And STDOUT should contain:
195+
"""
196+
Success:
197+
"""
198+
And STDERR should be empty
199+
And the return code should be 0

0 commit comments

Comments
 (0)