@@ -5,9 +5,9 @@ Feature: Install WordPress plugins
55
66 When I run `wp plugin install https://github.com/runcommand/one-time-login/archive/master.zip --activate`
77 Then STDOUT should contain:
8- """"
8+ """
99 Downloading install
10- """ "
10+ """
1111 And STDOUT should contain:
1212 """
1313 package from https://github.com/runcommand/one-time-login/archive/master.zip
@@ -20,7 +20,6 @@ Feature: Install WordPress plugins
2020 """
2121 Plugin installed successfully.
2222 """
23- And STDERR should be empty
2423 And the wp-content/plugins/one-time-login directory should exist
2524 And the wp-content/plugins/one-time-login-master directory should not exist
2625
@@ -45,6 +44,20 @@ Feature: Install WordPress plugins
4544 And the wp-content/plugins/one-time-login directory should exist
4645 And the wp-content/plugins/one-time-login-master directory should not exist
4746
47+ # However if the plugin slug ('modern-framework') does not match the project name then it's downloaded to wrong directory.
48+ When I run `wp plugin install https://github.com/Miller-Media/modern-wordpress/archive/master.zip`
49+ Then STDOUT should contain:
50+ """
51+ Plugin installed successfully.
52+ """
53+ And STDOUT should contain:
54+ """
55+ Renamed Github-based project from 'modern-wordpress-master' to 'modern-wordpress'.
56+ """
57+ # Wrong directory.
58+ And the wp-content/plugins/modern-wordpress directory should exist
59+ And the wp-content/plugins/modern-framework directory should not exist
60+
4861 Scenario : Don't attempt to rename ZIPs uploaded to GitHub's releases page
4962 Given a WP install
5063
@@ -55,9 +68,8 @@ Feature: Install WordPress plugins
5568 """
5669 And STDOUT should not contain:
5770 """
58- Renamed Github-based project from
71+ Renamed Github-based project from 'one-time-login.0.1.2' to 'one-time-login'.
5972 """
60- And STDERR should be empty
6173 And the wp-content/plugins/one-time-login directory should exist
6274
6375 Scenario : Don't attempt to rename ZIPs coming from a GitHub raw source
@@ -70,9 +82,8 @@ Feature: Install WordPress plugins
7082 """
7183 And STDOUT should not contain:
7284 """
73- Renamed Github-based project from
85+ Renamed Github-based project from 'modern-framework-stable' to 'modern-framework'.
7486 """
75- And STDERR should be empty
7687 And the wp-content/plugins/modern-framework directory should exist
7788
7889 Scenario : Installing respects WP_PROXY_HOST and WP_PROXY_PORT
@@ -101,7 +112,6 @@ Feature: Install WordPress plugins
101112 """
102113 Plugin installed successfully.
103114 """
104- And STDERR should be empty
105115
106116 Scenario : Return code is 1 when one or more plugin installations fail
107117 Given a WP install
@@ -161,7 +171,7 @@ Feature: Install WordPress plugins
161171 """
162172 And the return code should be 1
163173
164- Scenario: Don't attempt to rename ZIPs coming from a GitHub archive release/tag
174+ Scenario : For Github archive URLs use the Github project name as the plugin directory
165175 Given a WP install
166176
167177 When I run `wp plugin install https://github.com/wp-cli-test/generic-example-plugin/archive/v0.1.0.zip`
@@ -177,11 +187,23 @@ Feature: Install WordPress plugins
177187 """
178188 Renamed Github-based project from 'generic-example-plugin-0.1.0' to 'generic-example-plugin'.
179189 """
180- And STDOUT should contain:
181- """
182- Plugin installed successfully.
183- """
184- And STDERR should be empty
185190 And the wp-content/plugins/generic-example-plugin directory should exist
186191 And the wp-content/plugins/generic-example-plugi directory should not exist
187192 And the wp-content/plugins/generic-example-plugin-0.1.0 directory should not exist
193+
194+ When I run `wp plugin install https://github.com/Automattic/sensei/archive/version/1.9.19.zip`
195+ Then STDOUT should contain:
196+ """
197+ Plugin installed successfully.
198+ """
199+ And STDOUT should contain:
200+ """
201+ package from https://github.com/Automattic/sensei/archive/version/1.9.19.zip
202+ """
203+ And STDOUT should contain:
204+ """
205+ Renamed Github-based project from 'sensei-version-1.9.19' to 'sensei'.
206+ """
207+ And the wp-content/plugins/sensei directory should exist
208+ And the wp-content/plugins/archive directory should not exist
209+ And the wp-content/plugins/sensei-version-1.9.19 directory should not exist
0 commit comments