11Feature : Download WordPress.org extensions without loading WordPress
22
33 Scenario : Downloading a plugin package works before WordPress is loaded
4- Given a WP install
4+ Given an empty directory
55
6- When I run `wp plugin download debug-bar --skip-wordpress `
6+ When I run `wp plugin download debug-bar`
77 Then STDOUT should contain:
88 """
99 Downloading debug-bar
@@ -16,10 +16,77 @@ Feature: Download WordPress.org extensions without loading WordPress
1616 And the {DOWNLOADED_PLUGIN} file should exist
1717 And STDERR should be empty
1818
19+ Scenario : Downloading a plugin package to a custom path
20+ Given an empty directory
21+
22+ When I run `wp plugin download debug-bar --path=/tmp/wp-cli-download-test-plugin`
23+ Then STDOUT should contain:
24+ """
25+ Success: Downloaded plugin package to
26+ """
27+ And the /tmp/wp-cli-download-test-plugin/debug-bar file should exist
28+ And STDERR should be empty
29+
30+ Scenario : Downloading a specific version of a plugin
31+ Given an empty directory
32+
33+ When I run `wp plugin download debug-bar --version=1.4`
34+ Then STDOUT should contain:
35+ """
36+ Downloading debug-bar (1.4)
37+ """
38+ And STDOUT should contain:
39+ """
40+ Success: Downloaded plugin package to
41+ """
42+ And STDERR should be empty
43+
44+ Scenario : Downloading a non-existent version of a plugin fails with clear error
45+ Given an empty directory
46+
47+ When I try `wp plugin download debug-bar --version=9.9.9`
48+ Then STDERR should contain:
49+ """
50+ Error: Can't find the requested plugin's version 9.9.9
51+ """
52+ And the return code should be 1
53+
54+ Scenario : Downloading a plugin with --force overwrites existing file
55+ Given an empty directory
56+
57+ When I run `wp plugin download debug-bar`
58+ And I run `wp plugin download debug-bar --force`
59+ Then STDOUT should contain:
60+ """
61+ Success: Downloaded plugin package to
62+ """
63+ And STDERR should be empty
64+
65+ Scenario : Downloading a plugin without --force fails if destination exists
66+ Given an empty directory
67+
68+ When I run `wp plugin download debug-bar`
69+ And I try `wp plugin download debug-bar`
70+ Then STDERR should contain:
71+ """
72+ Error: Destination file already exists:
73+ """
74+ And the return code should be 1
75+
76+ Scenario : Downloading an unknown plugin fails with a clear error
77+ Given an empty directory
78+
79+ When I try `wp plugin download this-plugin-does-not-exist-xyz-abc-123`
80+ Then STDERR should contain:
81+ """
82+ Error: The 'this-plugin-does-not-exist-xyz-abc-123' plugin could not be found.
83+ """
84+ And the return code should be 1
85+
1986 Scenario : Downloading a theme package works before WordPress is loaded
20- Given a WP install
87+ Given an empty directory
2188
22- When I run `wp theme download twentytwelve --skip-wordpress `
89+ When I run `wp theme download twentytwelve`
2390 Then STDOUT should contain:
2491 """
2592 Downloading twentytwelve
@@ -31,3 +98,70 @@ Feature: Download WordPress.org extensions without loading WordPress
3198 And save STDOUT 'Success: Downloaded theme package to (.+)' as {DOWNLOADED_THEME}
3299 And the {DOWNLOADED_THEME} file should exist
33100 And STDERR should be empty
101+
102+ Scenario : Downloading a theme package to a custom path
103+ Given an empty directory
104+
105+ When I run `wp theme download twentytwelve --path=/tmp/wp-cli-download-test-theme`
106+ Then STDOUT should contain:
107+ """
108+ Success: Downloaded theme package to
109+ """
110+ And the /tmp/wp-cli-download-test-theme/twentytwelve file should exist
111+ And STDERR should be empty
112+
113+ Scenario : Downloading a specific version of a theme
114+ Given an empty directory
115+
116+ When I run `wp theme download twentytwelve --version=1.3`
117+ Then STDOUT should contain:
118+ """
119+ Downloading twentytwelve (1.3)
120+ """
121+ And STDOUT should contain:
122+ """
123+ Success: Downloaded theme package to
124+ """
125+ And STDERR should be empty
126+
127+ Scenario : Downloading a non-existent version of a theme fails with clear error
128+ Given an empty directory
129+
130+ When I try `wp theme download twentytwelve --version=9.9.9`
131+ Then STDERR should contain:
132+ """
133+ Error: Can't find the requested theme's version 9.9.9
134+ """
135+ And the return code should be 1
136+
137+ Scenario : Downloading a theme with --force overwrites existing file
138+ Given an empty directory
139+
140+ When I run `wp theme download twentytwelve`
141+ And I run `wp theme download twentytwelve --force`
142+ Then STDOUT should contain:
143+ """
144+ Success: Downloaded theme package to
145+ """
146+ And STDERR should be empty
147+
148+ Scenario : Downloading a theme without --force fails if destination exists
149+ Given an empty directory
150+
151+ When I run `wp theme download twentytwelve`
152+ And I try `wp theme download twentytwelve`
153+ Then STDERR should contain:
154+ """
155+ Error: Destination file already exists:
156+ """
157+ And the return code should be 1
158+
159+ Scenario : Downloading an unknown theme fails with a clear error
160+ Given an empty directory
161+
162+ When I try `wp theme download this-theme-does-not-exist-xyz-abc-123`
163+ Then STDERR should contain:
164+ """
165+ Error: The 'this-theme-does-not-exist-xyz-abc-123' theme could not be found.
166+ """
167+ And the return code should be 1
0 commit comments