11Feature : Patch command available for the transient cache
22
3- Scenario : Nested values from transient can be updated at any depth.
3+ Scenario : Nested values from transient can be inserted at any depth.
44 Given a WP install
55 And I run `wp eval "set_transient( 'my_key', ['foo' => 'bar'] );" `
66 And I run `wp eval "set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );" `
@@ -11,64 +11,140 @@ Feature: Patch command available for the transient cache
1111 Success: Updated transient 'my_key'.
1212 """
1313
14- When I run `wp transient patch insert my_key_2 foo fuz bar`
14+ When I run `wp transient get my_key --format=json`
15+ Then STDOUT should be:
16+ """
17+ {"foo":"bar","fuz":"baz"}
18+ """
19+
20+ When I run `wp transient patch insert my_key foo bar`
21+ Then STDOUT should be:
22+ """
23+ Success: Value passed for transient 'my_key' is unchanged.
24+ """
25+
26+ When I run `wp transient get my_key --format=json`
27+ Then STDOUT should be:
28+ """
29+ {"foo":"bar","fuz":"baz"}
30+ """
31+
32+ When I run `wp transient patch insert my_key_2 foo fuz biz`
1533 Then STDOUT should be:
1634 """
1735 Success: Updated transient 'my_key_2'.
1836 """
1937
20- When I try `wp transient patch insert unknown_key foo bar `
21- Then STDERR should be:
38+ When I run `wp transient get my_key_2 --format=json `
39+ Then STDOUT should be:
2240 """
23- Error: Cannot create key "foo" on data type boolean
41+ { "foo":{"bar":"baz","fuz":"biz"}}
2442 """
2543
26- When I run `wp transient patch insert my_key foo bar`
44+ When I run `wp transient patch insert my_key_2 foo bar baz `
2745 Then STDOUT should be:
2846 """
29- Success: Value passed for transient 'my_key' is unchanged.
47+ Success: Value passed for transient 'my_key_2' is unchanged.
48+ """
49+
50+ When I run `wp transient get my_key_2 --format=json`
51+ Then STDOUT should be:
3052 """
53+ {"foo":{"bar":"baz","fuz":"biz"}}
54+ """
55+
56+ Scenario : Nested values from transient can be updated at any depth.
57+ Given a WP install
58+ And I run `wp eval "set_transient( 'my_key', ['foo' => 'bar'] );" `
59+ And I run `wp eval "set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );" `
3160
32- When I run `wp transient patch update my_key foo biz `
61+ When I run `wp transient patch update my_key foo baz `
3362 Then STDOUT should be:
3463 """
3564 Success: Updated transient 'my_key'.
3665 """
3766
67+ When I run `wp transient get my_key --format=json`
68+ Then STDOUT should be:
69+ """
70+ {"foo":"baz"}
71+ """
72+
73+ When I run `wp transient patch update my_key foo baz`
74+ Then STDOUT should be:
75+ """
76+ Success: Value passed for transient 'my_key' is unchanged.
77+ """
78+
79+ When I run `wp transient get my_key --format=json`
80+ Then STDOUT should be:
81+ """
82+ {"foo":"baz"}
83+ """
84+
3885 When I run `wp transient patch update my_key_2 foo bar biz`
3986 Then STDOUT should be:
4087 """
4188 Success: Updated transient 'my_key_2'.
4289 """
4390
44- When I try `wp transient patch update unknown_key foo bar `
45- Then STDERR should be:
91+ When I run `wp transient get my_key_2 --format=json `
92+ Then STDOUT should be:
4693 """
47- Error: No data exists for key "foo"
94+ { "foo":{"bar":"biz"}}
4895 """
4996
50- When I run `wp transient patch update my_key foo bar`
97+ When I run `wp transient patch update my_key_2 foo bar biz `
5198 Then STDOUT should be:
5299 """
53- Success: Value passed for transient 'my_key ' is unchanged.
100+ Success: Value passed for transient 'my_key_2 ' is unchanged.
54101 """
55102
103+ When I run `wp transient get my_key_2 --format=json`
104+ Then STDOUT should be:
105+ """
106+ {"foo":{"bar":"biz"}}
107+ """
108+
109+ Scenario : Nested values from transient can be deleted at any depth.
110+ Given a WP install
111+ And I run `wp eval "set_transient( 'my_key', ['foo' => 'bar'] );" `
112+ And I run `wp eval "set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );" `
113+
56114 When I run `wp transient patch delete my_key foo`
57115 Then STDOUT should be:
58116 """
59117 Success: Updated transient 'my_key'.
60118 """
61119
120+ When I run `wp transient get my_key --format=json`
121+ Then STDOUT should be:
122+ """
123+ []
124+ """
125+
62126 When I run `wp transient patch delete my_key_2 foo bar`
63127 Then STDOUT should be:
64128 """
65129 Success: Updated transient 'my_key_2'.
66130 """
67131
68- When I try `wp transient patch delete unknown_key foo `
69- Then STDERR should be:
132+ When I run `wp transient get my_key_2 --format=json `
133+ Then STDOUT should be:
70134 """
71- Error: No data exists for key "foo"
135+ {"foo":[]}
136+ """
137+
138+ When I run `wp transient patch delete my_key_2 foo`
139+ Then STDOUT should be:
140+ """
141+ Success: Updated transient 'my_key_2'.
142+ """
143+
144+ When I run `wp transient get my_key_2 --format=json`
145+ Then STDOUT should be:
146+ """
147+ []
72148 """
73149
74150 Scenario : Nested values from site transient can be updated at any depth.
0 commit comments