Skip to content

Commit 0ccda0d

Browse files
committed
Tests: improve Windows compatibility
1 parent 0e4392a commit 0ccda0d

5 files changed

Lines changed: 15 additions & 11 deletions

File tree

features/plugin-install.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ Feature: Install WordPress plugins
168168
Scenario: Paths aren't backslashed when destination folder already exists
169169
Given a WP install
170170

171-
When I run `pwd`
171+
When I run `wp eval "echo str_replace('\\', '/', getcwd());"`
172172
Then save STDOUT as {WORKING_DIR}
173173

174174
When I run `rm wp-content/plugins/akismet/akismet.php`

features/plugin-list-recently-active.feature

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ Feature: List recently active WordPress plugins
6363
Success: Deactivated 2 of 2 plugins.
6464
"""
6565

66-
When I run `wp plugin activate $(wp plugin list --recently-active --field=name)`
66+
When I run `wp plugin list --recently-active --field=name`
67+
Then save STDOUT as {RECENTLY_ACTIVE_PLUGINS}
68+
When I run `wp plugin activate {RECENTLY_ACTIVE_PLUGINS}`
6769
Then STDOUT should contain:
6870
"""
6971
Plugin 'debug-bar' activated.
@@ -135,7 +137,9 @@ Feature: List recently active WordPress plugins
135137
Success: Network deactivated 2 of 2 plugins.
136138
"""
137139

138-
When I run `wp plugin activate $(wp plugin list --recently-active --field=name) --network`
140+
When I run `wp plugin list --recently-active --field=name`
141+
Then save STDOUT as {RECENTLY_ACTIVE_PLUGINS_MU}
142+
When I run `wp plugin activate {RECENTLY_ACTIVE_PLUGINS_MU} --network`
139143
Then STDOUT should contain:
140144
"""
141145
Plugin 'site-secrets' network activated.

features/plugin.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ Feature: Manage WordPress plugins
467467
Given a WP install
468468

469469
When I run `rm -rf wp-content/plugins`
470-
And I run `if test -d wp-content/plugins; then echo "fail"; fi`
470+
And I run `wp eval "if ( is_dir('wp-content/plugins') ) echo 'fail';"`
471471
Then STDOUT should be empty
472472

473473
When I run `wp plugin install wordpress-importer --activate`

features/theme-update.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Feature: Update WordPress themes
264264
And I run `wp theme path twentytwelve --dir`
265265
And save STDOUT as {THEME_DIR}
266266

267-
When I run `mkdir {THEME_DIR}/.git`
267+
When I run `wp eval "mkdir('{THEME_DIR}/.git', 0777, true);"`
268268
And I try `wp theme update twentytwelve`
269269
Then STDERR should contain:
270270
"""
@@ -282,7 +282,7 @@ Feature: Update WordPress themes
282282
And I run `wp theme path twentytwelve --dir`
283283
And save STDOUT as {THEME_DIR}
284284

285-
When I run `mkdir {THEME_DIR}/.git`
285+
When I run `wp eval "mkdir('{THEME_DIR}/.git', 0777, true);"`
286286
And I run `wp theme update twentytwelve --include-vcs`
287287
Then STDOUT should contain:
288288
"""

features/theme.feature

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,13 @@ Feature: Manage WordPress themes
243243
When I run `wp theme list`
244244
Then STDOUT should not be empty
245245

246-
When I run `wp eval 'echo get_site_transient("update_themes")->last_checked;'`
246+
When I run `wp eval "echo get_site_transient(\"update_themes\")->last_checked;"`
247247
Then save STDOUT as {LAST_UPDATED}
248248

249249
When I run `wp theme list --skip-update-check`
250250
Then STDOUT should not be empty
251251

252-
When I run `wp eval 'echo get_site_transient("update_themes")->last_checked;'`
252+
When I run `wp eval "echo get_site_transient(\"update_themes\")->last_checked;"`
253253
Then STDOUT should be:
254254
"""
255255
{LAST_UPDATED}
@@ -258,7 +258,7 @@ Feature: Manage WordPress themes
258258
When I run `wp theme list`
259259
Then STDOUT should not be empty
260260

261-
When I run `wp eval 'echo get_site_transient("update_themes")->last_checked;'`
261+
When I run `wp eval "echo get_site_transient(\"update_themes\")->last_checked;"`
262262
Then STDOUT should not contain:
263263
"""
264264
{LAST_UPDATED}
@@ -269,7 +269,7 @@ Feature: Manage WordPress themes
269269
And I run `wp theme delete --all --force`
270270

271271
When I run `rm -rf wp-content/themes`
272-
And I run `if test -d wp-content/themes; then echo "fail"; fi`
272+
And I run `wp eval "if ( is_dir('wp-content/themes') ) echo 'fail';"`
273273
Then STDOUT should be empty
274274

275275
When I run `wp theme install twentytwelve --activate`
@@ -283,7 +283,7 @@ Feature: Manage WordPress themes
283283
Scenario: Attempt to activate or fetch a broken theme
284284
Given a WP install
285285

286-
When I run `mkdir -pv wp-content/themes/myth`
286+
When I run `wp eval "mkdir('wp-content/themes/myth', 0777, true);"`
287287
Then the wp-content/themes/myth directory should exist
288288

289289
When I try `wp theme activate myth`

0 commit comments

Comments
 (0)