-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathcore-check-update.feature
More file actions
88 lines (72 loc) · 2.67 KB
/
core-check-update.feature
File metadata and controls
88 lines (72 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
Feature: Check for more recent versions
# This test downgrades to an older WordPress version, but the SQLite plugin requires 6.0+
@require-mysql
Scenario: Check for update via Version Check API
Given a WP install
And I try `wp theme install twentytwenty --activate`
When I run `wp core download --version=5.8 --force`
Then STDOUT should not be empty
When I run `wp core check-update --format=csv`
Then STDOUT should match #{WP_VERSION-latest},major,https://downloads.(w|wordpress).org/release/wordpress-{WP_VERSION-latest}.zip#
And STDOUT should match #{WP_VERSION-5.8-latest},minor,https://downloads.(w|wordpress).org/release/wordpress-{WP_VERSION-5.8-latest}-partial-0.zip#
When I run `wp core check-update --format=count`
Then STDOUT should be:
"""
2
"""
When I run `wp core check-update --major --format=csv`
Then STDOUT should match #{WP_VERSION-latest},major,https://downloads.(w|wordpress).org/release/wordpress-{WP_VERSION-latest}.zip#
When I run `wp core check-update --major --format=count`
Then STDOUT should be:
"""
1
"""
When I run `wp core check-update --minor --format=csv`
Then STDOUT should match #{WP_VERSION-5.8-latest},minor,https://downloads.(w|wordpress).org/release/wordpress-{WP_VERSION-5.8-latest}-partial-0.zip#
When I run `wp core check-update --minor --format=count`
Then STDOUT should be:
"""
1
"""
Scenario: Check output of check update in different formats (no updates available)
Given a WP install
And a setup.php file:
"""
<?php
global $wp_version;
$obj = new stdClass;
$obj->updates = [];
$obj->last_checked = strtotime( '1 January 2099' );
$obj->version_checked = $wp_version;
$obj->translations = [];
set_site_transient( 'update_core', $obj );
"""
And I run `wp eval-file setup.php`
When I run `wp core check-update`
Then STDOUT should be:
"""
Success: WordPress is at the latest version.
"""
When I run `wp core check-update --format=json`
Then STDOUT should be:
"""
[]
"""
When I run `wp core check-update --format=yaml`
Then STDOUT should be:
"""
---
"""
Scenario: Check update shows warning when version check API fails
Given a WP install
And that HTTP requests to https://api.wordpress.org/core/version-check/1.7/ will respond with:
"""
HTTP/1.1 500 Internal Server Error
Content-Type: text/plain
<Error body>
"""
When I try `wp core check-update --force-check`
Then STDERR should contain:
"""
Warning: Failed to check for updates
"""