Skip to content

Commit 9708a3a

Browse files
committed
Add a regression test for renamed-Phar config template resolution
A Phar renamed away from `wp-cli.phar` used to build malformed template paths when generating a wp-config.php for an install in another directory via --path, failing with "wp-config.mustache is not a file in phar". Add a Bootstrap scenario that copies the freshly built Phar to a name without an extension and runs `config create --path=subfolder` against a separate install, so the fixed behavior is locked in and regressions are caught. The fix itself lives in wp-cli/wp-cli's Path::phar_safe(), which the bundled Phar picks up through the framework. See wp-cli/config-command#141.
1 parent 4b00784 commit 9708a3a

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎features/bootstrap.feature‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,20 @@ Feature: Bootstrap WP-CLI
8181
Status: Inactive
8282
"""
8383
And STDERR should be empty
84+
85+
Scenario: Config template resolves when the PHAR is renamed and run against another path
86+
87+
# Reproduces the reported failure: a Phar renamed away from `wp-cli.phar`
88+
# (here without an extension) generating a wp-config.php for an install in a
89+
# different directory via --path. See https://github.com/wp-cli/config-command/issues/141
90+
Given an empty directory
91+
And a new Phar with the same version
92+
93+
When I run `cp {PHAR_PATH} wp-renamed`
94+
And I run `php wp-renamed core download --path=subfolder`
95+
And I run `php wp-renamed config create --path=subfolder --dbname=wordpress --dbuser=root --dbpass=password --skip-check`
96+
Then STDOUT should contain:
97+
"""
98+
Success: Generated 'wp-config.php' file.
99+
"""
100+
And STDERR should be empty

0 commit comments

Comments
 (0)