Skip to content

Commit 04d986e

Browse files
authored
Add Behat scenarios for wp cli update --stable / --nightly PHP version checks (#1093)
1 parent 9e0b114 commit 04d986e

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

‎features/cli.feature‎

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,44 @@ Feature: `wp cli` tasks
173173
"""
174174
WP-CLI {UPDATE_VERSION}
175175
"""
176+
177+
Scenario: Prevent stable update when PHP version requirement is not met
178+
Given an empty directory
179+
And a new Phar with version "2.8.0"
180+
And that HTTP requests to https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.manifest.json will respond with:
181+
"""
182+
HTTP/1.1 200
183+
Content-Type: application/json
184+
185+
{
186+
"requires_php": "99.0.0"
187+
}
188+
"""
189+
190+
When I try `{PHAR_PATH} cli update --stable --yes`
191+
Then STDERR should contain:
192+
"""
193+
The requested update requires PHP 99.0.0 or higher.
194+
"""
195+
And the return code should be 1
196+
197+
Scenario: Prevent nightly update when PHP version requirement is not met
198+
Given an empty directory
199+
And a new Phar with version "2.8.0"
200+
And that HTTP requests to https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.manifest.json will respond with:
201+
"""
202+
HTTP/1.1 200
203+
Content-Type: application/json
204+
205+
{
206+
"requires_php": "99.0.0"
207+
}
208+
"""
209+
210+
When I try `{PHAR_PATH} cli update --nightly --yes`
211+
Then STDERR should contain:
212+
"""
213+
The requested update requires PHP 99.0.0 or higher.
214+
"""
215+
And the return code should be 1
216+

0 commit comments

Comments
 (0)