Skip to content

Commit 77d421e

Browse files
authored
Tests: Improve Windows & macOS compatibility (#974)
1 parent 86f7dbd commit 77d421e

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

features/command.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,8 @@ Feature: WP-CLI Commands
752752
honked
753753
"""
754754
755+
# No trailing spaces on Windows.
756+
@skip-windows
755757
Scenario: Register a longdesc for a given command
756758
Given an empty directory
757759
And a custom-cmd.php file:

features/requests.feature

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ Feature: Requests integration with both v1 and v2
3636
5.8
3737
"""
3838

39-
When I run `vendor/bin/wp eval 'var_dump( \WP_CLI\Utils\http_request( "GET", "https://example.com/" ) );'`
39+
Given a check-request-v1-phar.php file:
40+
"""
41+
<?php
42+
var_dump( \WP_CLI\Utils\http_request( "GET", "https://example.com/" ) );
43+
"""
44+
When I run `vendor/bin/wp eval-file check-request-v1-phar.php`
4045
Then STDOUT should contain:
4146
"""
4247
object(Requests_Response)
@@ -60,7 +65,12 @@ Feature: Requests integration with both v1 and v2
6065
5.8
6166
"""
6267

63-
When I run `wp eval 'var_dump( \WP_CLI\Utils\http_request( "GET", "https://example.com/" ) );'`
68+
Given a check-request-v1.php file:
69+
"""
70+
<?php
71+
var_dump( \WP_CLI\Utils\http_request( "GET", "https://example.com/" ) );
72+
"""
73+
When I run `wp eval-file check-request-v1.php`
6474
Then STDOUT should contain:
6575
"""
6676
object(Requests_Response)
@@ -77,6 +87,9 @@ Feature: Requests integration with both v1 and v2
7787
Success: Installed 1 of 1 plugins.
7888
"""
7989

90+
# Skip on Windows due to cURL error 60: SSL certificate problem: unable to get local issuer certificate
91+
# TODO: Investigate.
92+
@skip-windows
8093
Scenario: Current version with WordPress-bundled Requests v2
8194
Given a WP installation
8295
# Switch themes because twentytwentyfive requires a version newer than 6.2
@@ -91,7 +104,12 @@ Feature: Requests integration with both v1 and v2
91104
6.2
92105
"""
93106

94-
When I run `wp eval 'var_dump( \WP_CLI\Utils\http_request( "GET", "https://example.com/" ) );'`
107+
Given a check-request-v2.php file:
108+
"""
109+
<?php
110+
var_dump( \WP_CLI\Utils\http_request( "GET", "https://example.com/" ) );
111+
"""
112+
When I run `wp eval-file check-request-v2.php`
95113
Then STDOUT should contain:
96114
"""
97115
object(WpOrg\Requests\Response)
@@ -200,7 +218,12 @@ Feature: Requests integration with both v1 and v2
200218
"""
201219
202220
# This can throw deprecated warnings on PHP 8.1+.
203-
When I try `vendor/bin/wp eval 'var_dump( \WP_CLI\Utils\http_request( "GET", "https://example.com/" ) );'`
221+
Given a check-request-v2-phar.php file:
222+
"""
223+
<?php
224+
var_dump( \WP_CLI\Utils\http_request( 'GET', 'https://example.com/' ) );
225+
"""
226+
When I try `vendor/bin/wp eval-file check-request-v2-phar.php`
204227
Then STDOUT should contain:
205228
"""
206229
object(Requests_Response)
@@ -227,11 +250,11 @@ Feature: Requests integration with both v1 and v2
227250
Just another Composer-based WordPress site
228251
"""
229252
230-
When I run `vendor/bin/wp eval 'echo COOKIEHASH;'`
253+
When I run `vendor/bin/wp eval "echo COOKIEHASH;"`
231254
And save STDOUT as {COOKIEHASH}
232255
Then STDOUT should not be empty
233256
234-
When I run `vendor/bin/wp eval 'echo wp_generate_auth_cookie( 1, 32503680000 );'`
257+
When I run `vendor/bin/wp eval "echo wp_generate_auth_cookie( 1, 32503680000 );"`
235258
And save STDOUT as {AUTH_COOKIE}
236259
Then STDOUT should not be empty
237260

0 commit comments

Comments
 (0)