Skip to content

Commit 4792ac2

Browse files
authored
Tests: further Windows compatibility fixes (#609)
1 parent 613b0a6 commit 4792ac2

11 files changed

+232
-118
lines changed

features/comment-recount.feature

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ Feature: Recount comments on a post
1111
3
1212
"""
1313

14-
When I run `wp eval 'global $wpdb; $wpdb->update( $wpdb->posts, array( "comment_count" => 1 ), array( "ID" => 1 ) ); clean_post_cache( 1 );'`
14+
Given a recount-comments.php file:
15+
"""
16+
<?php
17+
global $wpdb;
18+
$wpdb->update( $wpdb->posts, array( "comment_count" => 1 ), array( "ID" => 1 ) );
19+
clean_post_cache( 1 );
20+
"""
21+
When I run `wp eval-file recount-comments.php`
1522
And I run `wp post get 1 --field=comment_count`
1623
Then STDOUT should be:
1724
"""

features/comment.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ Feature: Manage WordPress comments
289289
"""
290290
And the return code should be 0
291291

292+
@skip-windows
292293
Scenario: Approving/unapproving comments with multidigit comment ID
293294
Given I run `wp comment delete $(wp comment list --field=ID)`
294295
And I run `wp comment generate --count=10 --quiet`
@@ -343,6 +344,7 @@ Feature: Manage WordPress comments
343344
"""
344345
And the return code should be 0
345346

347+
@skip-windows
346348
Scenario: Spam/unspam comments with multidigit comment ID
347349
Given I run `wp comment delete $(wp comment list --field=ID)`
348350
And I run `wp comment generate --count=10 --quiet`
@@ -392,6 +394,7 @@ Feature: Manage WordPress comments
392394
"""
393395
And the return code should be 0
394396

397+
@skip-windows
395398
Scenario: Trash/untrash comments with multidigit comment ID
396399
Given I run `wp comment delete $(wp comment list --field=ID) --force`
397400
And I run `wp comment generate --count=10 --quiet`

features/post-block.feature

Lines changed: 185 additions & 105 deletions
Large diffs are not rendered by default.

features/post-meta.feature

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Feature: Manage post custom fields
22

3+
# Windows likes to include the quotes of the `"via STDIN"` string.
4+
@skip-windows
35
Scenario: Postmeta CRUD
46
Given a WP install
57

@@ -34,7 +36,7 @@ Feature: Manage post custom fields
3436
["1","2"]
3537
"""
3638

37-
When I run `echo 'via STDIN' | wp post-meta set 1 foo`
39+
When I run `echo "via STDIN" | wp post-meta set 1 foo`
3840
And I run `wp post-meta get 1 foo`
3941
Then STDOUT should be:
4042
"""

features/post.feature

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ Feature: Manage WordPress posts
224224
"""
225225
And a create-post.sh file:
226226
"""
227-
cat content.html | wp post create --post_title='Test post' --post_excerpt="A multiline
227+
cat content.html | wp post create --post_title="Test post" --post_excerpt="A multiline
228228
excerpt" --porcelain -
229229
"""
230230

@@ -265,14 +265,14 @@ Feature: Manage WordPress posts
265265
}
266266
"""
267267

268-
When I try `EDITOR='ex -i NONE -c q!' wp post edit {POST_ID}`
268+
When I try `EDITOR="ex -i NONE -c q!" wp post edit {POST_ID}`
269269
Then STDERR should contain:
270270
"""
271271
No change made to post content.
272272
"""
273273
And the return code should be 0
274274

275-
When I run `EDITOR='ex -i NONE -c %s/content/bunkum -c wq' wp post edit {POST_ID}`
275+
When I run `EDITOR="ex -i NONE -c %s/content/bunkum -c wq" wp post edit {POST_ID}`
276276
Then STDERR should be empty
277277
And STDOUT should contain:
278278
"""
@@ -473,7 +473,7 @@ Feature: Manage WordPress posts
473473
My\Post
474474
"""
475475

476-
When I run `wp post update {POST_ID} --post_content='var isEmailValid = /^\S+@\S+.\S+$/.test(email);'`
476+
When I run `wp post update {POST_ID} --post_content="var isEmailValid = /^\S+@\S+.\S+$/.test(email);"`
477477
Then STDOUT should not be empty
478478

479479
When I run `wp post get {POST_ID} --field=content`

features/site.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Feature: Manage sites in a multisite installation
3838
http://first.example.com
3939
"""
4040

41+
@skip-windows
4142
Scenario: Delete a site by id
4243
Given a WP multisite subdirectory install
4344

@@ -77,6 +78,7 @@ Feature: Manage sites in a multisite installation
7778
When I try the previous command again
7879
Then the return code should be 1
7980

81+
@skip-windows
8082
Scenario: Filter site list
8183
Given a WP multisite install
8284

@@ -212,6 +214,7 @@ Feature: Manage sites in a multisite installation
212214
"""
213215
And the return code should be 1
214216

217+
@skip-windows
215218
Scenario: Get site info
216219
Given a WP multisite install
217220

features/term-recount.feature

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,14 @@ Feature: Recount terms on a taxonomy
4040
"""
4141
1
4242
"""
43-
When I run `wp eval 'global $wpdb; $wpdb->update( $wpdb->term_taxonomy, array( "count" => 3 ), array( "term_id" => {TERM_ID} ) ); clean_term_cache( {TERM_ID}, "category" );'`
43+
Given a recount-terms.php file:
44+
"""
45+
<?php
46+
global $wpdb;
47+
$wpdb->update( $wpdb->term_taxonomy, array( "count" => 3 ), array( "term_id" => {TERM_ID} ) );
48+
clean_term_cache( {TERM_ID}, "category" );
49+
"""
50+
When I run `wp eval-file recount-terms.php`
4451
And I run `wp term get category {TERM_ID} --field=count`
4552
Then STDOUT should be:
4653
"""

features/term.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ Feature: Manage WordPress terms
181181
My\Term\Description
182182
"""
183183

184-
When I run `wp term update category {TERM_ID} --name='My\New\Term' --description='var isEmailValid = /^\S+@\S+.\S+$/.test(email);'`
184+
When I run `wp term update category {TERM_ID} --name="My\New\Term" --description="var isEmailValid = /^\S+@\S+.\S+$/.test(email);"`
185185
Then STDOUT should not be empty
186186

187187
When I run `wp term get category {TERM_ID} --field=name`

features/user-application-password.feature

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,15 @@ Feature: Manage user custom fields
271271
When I run `wp user application-password list {USER_ID} --name=someapp --field=uuid`
272272
Then save STDOUT as {UUID}
273273

274-
When I run `wp user application-password get {USER_ID} {UUID} --field=password | sed 's/\$/\\\$/g'`
274+
When I run `wp user application-password get {USER_ID} {UUID} --field=password`
275275
Then save STDOUT as {HASH}
276276

277-
When I run `wp eval "var_export( wp_check_password( '{PASSWORD}', '{HASH}', {USER_ID} ) );"`
277+
Given a check-password.php file:
278+
"""
279+
<?php
280+
var_export( wp_check_password( '{PASSWORD}', '{HASH}', {USER_ID} ) );
281+
"""
282+
When I run `wp eval-file check-password.php`
278283
Then STDOUT should contain:
279284
"""
280285
true
@@ -297,10 +302,15 @@ Feature: Manage user custom fields
297302
When I run `wp user application-password list {USER_ID} --name=someapp --field=uuid`
298303
Then save STDOUT as {UUID}
299304

300-
When I run `wp user application-password get {USER_ID} {UUID} --field=password | sed 's/\$/\\\$/g'`
305+
When I run `wp user application-password get {USER_ID} {UUID} --field=password`
301306
Then save STDOUT as {HASH}
302307

303-
When I run `wp eval "var_export( wp_verify_fast_hash( '{PASSWORD}', '{HASH}', {USER_ID} ) );"`
308+
Given a verify-fast-hash.php file:
309+
"""
310+
<?php
311+
var_export( wp_verify_fast_hash( '{PASSWORD}', '{HASH}', {USER_ID} ) );
312+
"""
313+
When I run `wp eval-file verify-fast-hash.php`
304314
Then STDOUT should contain:
305315
"""
306316
true

features/user-import-csv.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Feature: Import users from CSV
103103
}
104104
"""
105105

106+
@skip-windows
106107
Scenario: Import users from a CSV file generated by `wp user list`
107108
Given a WP install
108109

0 commit comments

Comments
 (0)