Skip to content

Commit 893e18d

Browse files
authored
Merge pull request #235 from wp-cli/fix/tests-for-new-requests
2 parents 620abff + 476647a commit 893e18d

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"wp-cli/db-command": "^1.3 || ^2",
2121
"wp-cli/entity-command": "^1.3 || ^2",
2222
"wp-cli/extension-command": "^1.2 || ^2",
23-
"wp-cli/wp-cli-tests": "^3.1.4"
23+
"wp-cli/wp-cli-tests": "^3.2.7"
2424
},
2525
"config": {
2626
"process-timeout": 7200,

features/core-check-update.feature

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ Feature: Check for more recent versions
44
Given a WP install
55
And I try `wp theme install twentytwenty --activate`
66

7-
When I run `wp core download --version=4.4 --force`
7+
When I run `wp core download --version=5.8 --force`
88
Then STDOUT should not be empty
99

1010
When I run `wp core check-update`
1111
Then STDOUT should be a table containing rows:
1212
| version | update_type | package_url |
1313
| {WP_VERSION-latest} | major | https://downloads.wordpress.org/release/wordpress-{WP_VERSION-latest}.zip |
14-
| {WP_VERSION-4.4-latest} | minor | https://downloads.wordpress.org/release/wordpress-{WP_VERSION-4.4-latest}-partial-0.zip |
14+
| {WP_VERSION-5.8-latest} | minor | https://downloads.wordpress.org/release/wordpress-{WP_VERSION-5.8-latest}-partial-0.zip |
1515

1616
When I run `wp core check-update --format=count`
1717
Then STDOUT should be:
@@ -33,7 +33,7 @@ Feature: Check for more recent versions
3333
When I run `wp core check-update --minor`
3434
Then STDOUT should be a table containing rows:
3535
| version | update_type | package_url |
36-
| {WP_VERSION-4.4-latest} | minor | https://downloads.wordpress.org/release/wordpress-{WP_VERSION-4.4-latest}-partial-0.zip |
36+
| {WP_VERSION-5.8-latest} | minor | https://downloads.wordpress.org/release/wordpress-{WP_VERSION-5.8-latest}-partial-0.zip |
3737

3838
When I run `wp core check-update --minor --format=count`
3939
Then STDOUT should be:

features/core-download.feature

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Feature: Download WordPress
1616
And save STDOUT 'Downloading WordPress ([\d\.]+)' as {VERSION}
1717
Then the wp-settings.php file should exist
1818
And the {SUITE_CACHE_DIR}/core/wordpress-{VERSION}-en_US.tar.gz file should exist
19-
And the {SUITE_CACHE_DIR}/core/wordpress-{WP_VERSION-latest}-en_US.tar.gz file should exist
2019

2120
When I run `mkdir inner`
2221
And I run `cd inner && wp core download`

features/core-update.feature

+8-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ Feature: Update WordPress core
6868
And I try `wp theme install twentytwenty --activate`
6969

7070
When I run `wp core download --version=4.1.30 --force`
71-
Then STDOUT should not be empty
71+
Then STDOUT should contain:
72+
"""
73+
Success: WordPress downloaded.
74+
"""
7275

7376
# This version of WP throws a PHP notice
7477
When I try `wp core update --minor`
@@ -260,6 +263,10 @@ Feature: Update WordPress core
260263
Then the wp-includes/Requests/Exception/Transport/Curl.php file should not exist
261264
Then the wp-includes/Requests/Exception/Http/Status502.php file should not exist
262265
Then the wp-includes/Requests/Iri.php file should not exist
266+
And STDOUT should contain:
267+
"""
268+
Success: WordPress updated successfully.
269+
"""
263270

264271
When I run `wp core update --version=5.9-beta1 --force`
265272
Then the wp-includes/Requests/Transport/cURL.php file should not exist

src/WP_CLI/Core/CoreUpgrader.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace WP_CLI\Core;
44

55
use Exception;
6-
use Requests_Response;
76
use WP_CLI;
87
use WP_CLI\Utils;
98
use WP_Error;
@@ -27,7 +26,7 @@ class CoreUpgrader extends DefaultCoreUpgrader {
2726
/**
2827
* CoreUpgrader constructor.
2928
*
30-
* @param WP_Upgrader_Skin|null $skin
29+
* @param \WP_Upgrader_Skin|null $skin
3130
*/
3231
public function __construct( $skin = null, $insecure = false ) {
3332
$this->insecure = $insecure;
@@ -115,7 +114,7 @@ function () use ( $temp ) {
115114

116115
$this->skin->feedback( 'downloading_package', $package );
117116

118-
/** @var Requests_Response|null $req */
117+
/** @var \Requests_Response|\WpOrg\Requests\Response null $req */
119118
try {
120119
$response = Utils\http_request( 'GET', $package, null, $headers, $options );
121120
} catch ( Exception $e ) {

0 commit comments

Comments
 (0)