Skip to content

Commit 6776a13

Browse files
committed
Update tests involving object cache
1 parent be4b090 commit 6776a13

2 files changed

Lines changed: 56 additions & 0 deletions

File tree

features/cache.feature

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Feature: Managed the WordPress object cache
22

3+
@skip-object-cache
34
Scenario: Default group is 'default'
45
Given a WP install
56
And a wp-content/mu-plugins/test-harness.php file:
@@ -210,3 +211,14 @@ Feature: Managed the WordPress object cache
210211

211212
When I run `wp cache supports set_multiple`
212213
Then the return code should be 0
214+
215+
@require-object-cache
216+
Scenario: Object caches may return success when deleting non-existent objects
217+
Given a WP install
218+
219+
When I run `wp cache delete nonexistentkey`
220+
Then STDOUT should be:
221+
"""
222+
Success: Object deleted.
223+
"""
224+
And the return code should be 0

features/transient.feature

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Feature: Manage WordPress transient cache
5555
Success: Transient deleted.
5656
"""
5757

58+
@skip-object-cache
5859
Scenario: Deleting all transients on single site
5960
Given a WP install
6061
# We set `WP_DEVELOPMENT_MODE` to stop WordPress from automatically creating
@@ -125,6 +126,7 @@ Feature: Manage WordPress transient cache
125126
Warning: Transient with key "foo4" is not set.
126127
"""
127128

129+
@skip-object-cache
128130
Scenario: Deleting expired transients on single site
129131
Given a WP install
130132
And I run `wp transient set foo bar 600`
@@ -196,6 +198,7 @@ Feature: Manage WordPress transient cache
196198
bar4
197199
"""
198200

201+
@skip-object-cache
199202
Scenario: Deleting all transients on multisite
200203
Given a WP multisite install
201204
# We set `WP_DEVELOPMENT_MODE` to stop WordPress from automatically creating
@@ -291,6 +294,7 @@ Feature: Manage WordPress transient cache
291294
Warning: Transient with key "foo6" is not set.
292295
"""
293296

297+
@skip-object-cache
294298
Scenario: Deleting expired transients on multisite
295299
Given a WP multisite install
296300
And I run `wp site create --slug=foo`
@@ -391,6 +395,7 @@ Feature: Manage WordPress transient cache
391395
bar6
392396
"""
393397

398+
@skip-object-cache
394399
Scenario: List transients on single site
395400
Given a WP install
396401
And I run `wp transient set foo bar`
@@ -446,6 +451,7 @@ Feature: Manage WordPress transient cache
446451
foo6,bar6,1321009871
447452
"""
448453

454+
@skip-object-cache
449455
Scenario: List transients on multisite
450456
Given a WP multisite install
451457
# We set `WP_DEVELOPMENT_MODE` to stop WordPress from automatically creating
@@ -504,6 +510,7 @@ Feature: Manage WordPress transient cache
504510
foo6,bar6,1321009871
505511
"""
506512

513+
@skip-object-cache
507514
Scenario: List transients with search and exclude pattern
508515
Given a WP install
509516
And I run `wp transient set foo bar`
@@ -603,3 +610,40 @@ Feature: Manage WordPress transient cache
603610
name
604611
foo4
605612
"""
613+
614+
@require-object-cache
615+
Scenario: Transient database operations warn when external object cache is active
616+
Given a WP install
617+
618+
When I try `wp transient list --format=count`
619+
Then STDERR should be:
620+
"""
621+
Warning: Transients are stored in an external object cache, and this command only shows those stored in the database.
622+
"""
623+
And STDOUT should be:
624+
"""
625+
0
626+
"""
627+
And the return code should be 0
628+
629+
When I try `wp transient delete --all`
630+
Then STDERR should be:
631+
"""
632+
Warning: Transients are stored in an external object cache, and this command only deletes those stored in the database. You must flush the cache to delete all transients.
633+
"""
634+
And STDOUT should be:
635+
"""
636+
Success: No transients found.
637+
"""
638+
And the return code should be 0
639+
640+
When I try `wp transient delete --expired`
641+
Then STDERR should be:
642+
"""
643+
Warning: Transients are stored in an external object cache, and this command only deletes those stored in the database. You must flush the cache to delete all transients.
644+
"""
645+
And STDOUT should be:
646+
"""
647+
Success: No expired transients found.
648+
"""
649+
And the return code should be 0

0 commit comments

Comments
 (0)