Skip to content

Commit 69e0f78

Browse files
authored
Merge pull request #74 from wp-cli/fix/make-transient-delete-test-more-robust
2 parents 0db0214 + be15fc6 commit 69e0f78

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

features/transient.feature

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ Feature: Manage WordPress transient cache
5757

5858
Scenario: Deleting all transients on single site
5959
Given a WP install
60+
And I run `wp transient list --format=count`
61+
And save STDOUT as {EXISTING_TRANSIENTS}
62+
And I run `expr {EXISTING_TRANSIENTS} + 2`
63+
And save STDOUT as {EXPECTED_TRANSIENTS}
6064

6165
When I try `wp transient delete`
6266
Then STDERR should be:
@@ -71,7 +75,7 @@ Feature: Manage WordPress transient cache
7175
And I run `wp transient delete --all`
7276
Then STDOUT should be:
7377
"""
74-
Success: 2 transients deleted from the database.
78+
Success: {EXPECTED_TRANSIENTS} transients deleted from the database.
7579
"""
7680

7781
When I try `wp transient get foo`
@@ -190,6 +194,10 @@ Feature: Manage WordPress transient cache
190194
Scenario: Deleting all transients on multisite
191195
Given a WP multisite install
192196
And I run `wp site create --slug=foo`
197+
And I run `wp transient list --format=count`
198+
And save STDOUT as {EXISTING_TRANSIENTS}
199+
And I run `expr {EXISTING_TRANSIENTS} + 2`
200+
And save STDOUT as {EXPECTED_TRANSIENTS}
193201

194202
When I try `wp transient delete`
195203
Then STDERR should be:
@@ -206,7 +214,7 @@ Feature: Manage WordPress transient cache
206214
And I run `wp transient delete --all`
207215
Then STDOUT should be:
208216
"""
209-
Success: 2 transients deleted from the database.
217+
Success: {EXPECTED_TRANSIENTS} transients deleted from the database.
210218
"""
211219

212220
When I try `wp transient get foo`
@@ -389,7 +397,7 @@ Feature: Manage WordPress transient cache
389397
And I run `wp option update _site_transient_timeout_foo6 1321009871`
390398

391399
When I run `wp transient list --format=csv`
392-
Then STDOUT should be:
400+
Then STDOUT should contain:
393401
"""
394402
name,value,expiration
395403
foo,bar,false
@@ -434,7 +442,7 @@ Feature: Manage WordPress transient cache
434442
And I run `wp site option update _site_transient_timeout_foo6 1321009871`
435443

436444
When I run `wp transient list --format=csv`
437-
Then STDOUT should be:
445+
Then STDOUT should contain:
438446
"""
439447
name,value,expiration
440448
foo,bar,false

0 commit comments

Comments
 (0)