Skip to content

Commit 7d3a483

Browse files
petitphpschlessera
authored andcommitted
Add test cases for invalid keys
1 parent 8d9ba42 commit 7d3a483

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

features/transient-patch.feature

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ Feature: Patch command available for the transient cache
5353
{"foo":{"bar":"baz","fuz":"biz"}}
5454
"""
5555

56+
When I try `wp transient patch insert unknown_key foo bar`
57+
Then STDERR should be:
58+
"""
59+
Error: Cannot create key "foo" on data type boolean
60+
"""
61+
5662
Scenario: Nested values from transient can be updated at any depth.
5763
Given a WP install
5864
And I run `wp eval "set_transient( 'my_key', ['foo' => 'bar'] );"`
@@ -106,6 +112,12 @@ Feature: Patch command available for the transient cache
106112
{"foo":{"bar":"biz"}}
107113
"""
108114

115+
When I try `wp transient patch update unknown_key foo bar`
116+
Then STDERR should be:
117+
"""
118+
Error: No data exists for key "foo"
119+
"""
120+
109121
Scenario: Nested values from transient can be deleted at any depth.
110122
Given a WP install
111123
And I run `wp eval "set_transient( 'my_key', ['foo' => 'bar'] );"`
@@ -147,6 +159,12 @@ Feature: Patch command available for the transient cache
147159
[]
148160
"""
149161

162+
When I try `wp transient patch delete unknown_key foo`
163+
Then STDERR should be:
164+
"""
165+
Error: No data exists for key "foo"
166+
"""
167+
150168
Scenario: Nested values from site transient can be inserted at any depth.
151169
Given a WP multisite install
152170
And I run `wp eval "set_site_transient( 'my_key', ['foo' => 'bar'] );"`
@@ -200,6 +218,12 @@ Feature: Patch command available for the transient cache
200218
{"foo":{"bar":"baz","fuz":"biz"}}
201219
"""
202220

221+
When I try `wp transient patch insert unknown_key foo bar --network`
222+
Then STDERR should be:
223+
"""
224+
Error: Cannot create key "foo" on data type boolean
225+
"""
226+
203227
Scenario: Nested values from site transient can be updated at any depth.
204228
Given a WP multisite install
205229
And I run `wp eval "set_site_transient( 'my_key', ['foo' => 'bar'] );"`
@@ -253,6 +277,12 @@ Feature: Patch command available for the transient cache
253277
{"foo":{"bar":"biz"}}
254278
"""
255279

280+
When I try `wp transient patch update unknown_key foo bar --network`
281+
Then STDERR should be:
282+
"""
283+
Error: No data exists for key "foo"
284+
"""
285+
256286
Scenario: Nested values from site transient can be deleted at any depth.
257287
Given a WP multisite install
258288
And I run `wp eval "set_site_transient( 'my_key', ['foo' => 'bar'] );"`
@@ -293,3 +323,9 @@ Feature: Patch command available for the transient cache
293323
"""
294324
[]
295325
"""
326+
327+
When I try `wp transient patch delete unknown_key foo --network`
328+
Then STDERR should be:
329+
"""
330+
Error: No data exists for key "foo"
331+
"""

0 commit comments

Comments
 (0)