Skip to content

Commit 2993729

Browse files
committed
Add tests to trigger phar path resolution bug
1 parent 8029a8e commit 2993729

File tree

4 files changed

+59
-5
lines changed

4 files changed

+59
-5
lines changed

features/bootstrap.feature

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,30 @@ Feature: Bootstrap WP-CLI
5454
"""
5555
WP-Override-CLI
5656
"""
57+
58+
Scenario: Template paths should be resolved correctly when PHAR is renamed
59+
60+
Given an empty directory
61+
And a new Phar with the same version
62+
And a WP installation
63+
And I run `wp plugin install https://github.com/wp-cli-test/generic-example-plugin/releases/download/v0.1.1/generic-example-plugin.0.1.1.zip --activate`
64+
And I run `wp plugin deactivate generic-example-plugin`
65+
66+
When I run `{PHAR_PATH} plugin status generic-example-plugin`
67+
Then STDOUT should contain:
68+
"""
69+
Plugin generic-example-plugin details:
70+
Name: Example Plugin
71+
Status: Inactive
72+
"""
73+
And STDERR should be empty
74+
75+
When I run `cp {PHAR_PATH} wp-renamed.phar`
76+
And I try `php wp-renamed.phar plugin status generic-example-plugin`
77+
Then STDOUT should contain:
78+
"""
79+
Plugin generic-example-plugin details:
80+
Name: Example Plugin
81+
Status: Inactive
82+
"""
83+
And STDERR should be empty

features/cli.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ Feature: `wp cli` tasks
149149
When I run `{PHAR_PATH} cli update --stable < session`
150150
Then STDOUT should contain:
151151
"""
152-
You have version 2.8.0. Would you like to update to the latest stable release? [y/n]
152+
You are currently using WP-CLI version 2.8.0. Would you like to update to the latest stable release? [y/n]
153153
"""
154154
And STDOUT should contain:
155155
"""

features/make-phar.feature

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,30 @@ Feature: Check `utils/make-phar.php` output
2929
Then the return code should be 1
3030
And STDOUT should be empty
3131
And STDERR should be empty
32+
33+
Scenario: Phar renaming affects template path resolution
34+
Given an empty directory
35+
And a new Phar with the same version
36+
And a WP installation
37+
And I run `wp plugin install https://github.com/wp-cli-test/generic-example-plugin/releases/download/v0.1.1/generic-example-plugin.0.1.1.zip --activate`
38+
And I run `wp plugin deactivate generic-example-plugin`
39+
40+
When I run `{PHAR_PATH} plugin status generic-example-plugin`
41+
Then STDOUT should contain:
42+
"""
43+
Plugin generic-example-plugin details:
44+
Name: Example Plugin
45+
Status: Inactive
46+
Version:
47+
Author:
48+
Description:
49+
"""
50+
And STDERR should be empty
51+
52+
When I run `cp {PHAR_PATH} wp`
53+
And I try `php wp plugin status generic-example-plugin`
54+
Then STDERR should contain:
55+
"""
56+
Error: Couldn't find plugin-status.mustache
57+
"""
58+
And the return code should not be 0

features/requests.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Feature: Requests integration with both v1 and v2
7171
"""
7272
And STDERR should be empty
7373

74-
When I run `wp plugin install duplicate-post`
74+
When I run `wp plugin install https://github.com/wp-cli-test/generic-example-plugin/releases/download/v0.1.1/generic-example-plugin.0.1.1.zip`
7575
Then STDOUT should contain:
7676
"""
7777
Success: Installed 1 of 1 plugins.
@@ -102,7 +102,7 @@ Feature: Requests integration with both v1 and v2
102102
"""
103103
And STDERR should be empty
104104

105-
When I run `wp plugin install duplicate-post`
105+
When I run `wp plugin install https://github.com/wp-cli-test/generic-example-plugin/releases/download/v0.1.1/generic-example-plugin.0.1.1.zip`
106106
Then STDOUT should contain:
107107
"""
108108
Success: Installed 1 of 1 plugins.
@@ -212,7 +212,7 @@ Feature: Requests integration with both v1 and v2
212212
213213
# This can throw deprecated warnings on PHP 8.1+.
214214
# Also, using a specific version to avoid minimum WordPress version requirement warning.
215-
When I try `vendor/bin/wp plugin install duplicate-post --version=4.2 --activate`
215+
When I try `vendor/bin/wp plugin install https://github.com/wp-cli-test/generic-example-plugin/releases/download/v0.1.1/generic-example-plugin.0.1.1.zip --version=4.2 --activate`
216216
Then STDOUT should contain:
217217
"""
218218
Success: Installed 1 of 1 plugins.
@@ -242,5 +242,5 @@ Feature: Requests integration with both v1 and v2
242242
"""
243243
And STDOUT should contain:
244244
"""
245-
plugin=duplicate-post
245+
plugin=generic-example-plugin
246246
"""

0 commit comments

Comments
 (0)