@@ -55,15 +55,7 @@ Feature: Manage WordPress transient cache
5555 Success: Transient deleted.
5656 """
5757
58- When I run `wp transient set foo bar --network`
59- And I run `wp transient set foo2 bar2 --network`
60- And I run `wp transient delete --all --network`
61- Then STDOUT should be:
62- """
63- Success: 2 transients deleted from the database.
64- """
65-
66- Scenario : Transient delete and other flags
58+ Scenario : Deleting all transients on single site
6759 Given a WP install
6860
6961 When I try `wp transient delete`
@@ -73,20 +65,15 @@ Feature: Manage WordPress transient cache
7365 """
7466
7567 When I run `wp transient set foo bar`
76- And I run `wp transient set foo2 bar2`
68+ And I run `wp transient set foo2 bar2 600 `
7769 And I run `wp transient set foo3 bar3 --network`
70+ And I run `wp transient set foo4 bar4 600 --network`
7871 And I run `wp transient delete --all`
7972 Then STDOUT should be:
8073 """
8174 Success: 2 transients deleted from the database.
8275 """
8376
84- When I run `wp transient delete --all --network`
85- Then STDOUT should be:
86- """
87- Success: 1 transient deleted from the database.
88- """
89-
9077 When I try `wp transient get foo`
9178 Then STDERR should be:
9279 """
@@ -99,20 +86,46 @@ Feature: Manage WordPress transient cache
9986 Warning: Transient with key "foo2" is not set.
10087 """
10188
89+ When I run `wp transient get foo3 --network`
90+ Then STDOUT should be:
91+ """
92+ bar3
93+ """
94+
95+ When I run `wp transient get foo4 --network`
96+ Then STDOUT should be:
97+ """
98+ bar4
99+ """
100+
101+ When I run `wp transient delete --all --network`
102+ Then STDOUT should be:
103+ """
104+ Success: 2 transients deleted from the database.
105+ """
106+
102107 When I try `wp transient get foo3 --network`
103108 Then STDERR should be:
104109 """
105110 Warning: Transient with key "foo3" is not set.
106111 """
107112
108- When I run `wp transient set foo bar 60 `
109- Then STDOUT should be:
113+ When I try `wp transient get foo4 --network `
114+ Then STDERR should be:
110115 """
111- Success : Transient added .
116+ Warning : Transient with key "foo4" is not set .
112117 """
113118
119+ Scenario : Deleting expired transients on single site
120+ Given a WP install
121+
122+ When I run `wp transient set foo bar 60`
123+ And I run `wp transient set foo2 bar2 60`
124+ And I run `wp transient set foo3 bar3 60 --network`
125+ And I run `wp transient set foo4 bar4 60 --network`
114126 # Change timeout to be in the past.
115- When I run `wp option update _transient_timeout_foo 1321009871`
127+ And I run `wp option update _transient_timeout_foo 1321009871`
128+ And I run `wp option update _site_transient_timeout_foo3 1321009871`
116129 And I run `wp transient delete --expired`
117130 Then STDOUT should be:
118131 """
@@ -125,60 +138,76 @@ Feature: Manage WordPress transient cache
125138 Warning: Transient with key "foo" is not set.
126139 """
127140
128- When I run `wp transient set foo bar 60 --network `
141+ When I run `wp transient get foo2 `
129142 Then STDOUT should be:
130143 """
131- Success: Transient added.
144+ bar2
132145 """
133146
134- # Change timeout to be in the past.
135- When I run `wp option update _site_transient_timeout_foo 1321009871`
136- And I run `wp transient delete --expired --network`
147+ When I run `wp transient get foo3 --network`
137148 Then STDOUT should be:
138149 """
139- Success: 1 expired transient deleted from the database.
150+ bar3
151+ """
152+
153+ When I run `wp transient get foo4 --network`
154+ Then STDOUT should be:
155+ """
156+ bar4
157+ """
158+
159+ When I run `wp transient delete --expired --network`
160+ Then STDOUT should be:
161+ """
162+ Success: 1 expired transients deleted from the database.
140163 """
141164
142- When I try `wp transient get foo --network `
165+ When I try `wp transient get foo`
143166 Then STDERR should be:
144167 """
145168 Warning: Transient with key "foo" is not set.
146169 """
147170
148- When I run `wp transient set foo bar`
149- And I run `wp transient set foo2 bar2 600`
150- And I run `wp transient set foo3 bar3 --network`
151- And I run `wp transient set foo4 bar4 600 --network`
152- And I run `wp transient delete --all`
171+ When I run `wp transient get foo2`
153172 Then STDOUT should be:
154173 """
155- Success: 2 transients deleted from the database.
174+ bar2
156175 """
157176
158- When I run `wp transient delete --all --network`
177+ When I try `wp transient get foo3 --network`
178+ Then STDERR should be:
179+ """
180+ Warning: Transient with key "foo3" is not set.
181+ """
182+
183+ When I run `wp transient get foo4 --network`
159184 Then STDOUT should be:
160185 """
161- Success: 2 transients deleted from the database.
186+ bar4
162187 """
163188
164- Scenario : Network transient delete and other flags
189+ Scenario : Deleting all transients on multisite
165190 Given a WP multisite install
191+ And I run `wp site create --slug=foo`
192+
193+ When I try `wp transient delete`
194+ Then STDERR should be:
195+ """
196+ Error: Please specify transient key, or use --all or --expired.
197+ """
166198
167199 When I run `wp transient set foo bar`
168- And I run `wp transient set foo2 bar2`
200+ And I run `wp transient set foo2 bar2 600 `
169201 And I run `wp transient set foo3 bar3 --network`
202+ And I run `wp transient set foo4 bar4 600 --network`
203+ And I run `wp --url=example.com/foo transient set foo5 bar5 --network`
204+ And I run `wp --url=example.com/foo transient set foo6 bar6 600 --network`
170205 And I run `wp transient delete --all`
171206 Then STDOUT should be:
172207 """
173208 Success: 2 transients deleted from the database.
174209 """
175210
176- When I run `wp transient delete --all --network`
177- Then STDOUT should be:
178- """
179- Success: 1 transient deleted from the database.
180- """
181-
182211 When I try `wp transient get foo`
183212 Then STDERR should be:
184213 """
@@ -191,20 +220,74 @@ Feature: Manage WordPress transient cache
191220 Warning: Transient with key "foo2" is not set.
192221 """
193222
223+ When I run `wp transient get foo3 --network`
224+ Then STDOUT should be:
225+ """
226+ bar3
227+ """
228+
229+ When I run `wp transient get foo4 --network`
230+ Then STDOUT should be:
231+ """
232+ bar4
233+ """
234+
235+ When I run `wp --url=example.com/foo transient get foo5 --network`
236+ Then STDOUT should be:
237+ """
238+ bar5
239+ """
240+
241+ When I run `wp --url=example.com/foo transient get foo6 --network`
242+ Then STDOUT should be:
243+ """
244+ bar6
245+ """
246+
247+ When I run `wp transient delete --all --network`
248+ Then STDOUT should be:
249+ """
250+ Success: 4 transients deleted from the database.
251+ """
252+
194253 When I try `wp transient get foo3 --network`
195254 Then STDERR should be:
196255 """
197256 Warning: Transient with key "foo3" is not set.
198257 """
199258
200- When I run `wp transient set foo bar 60 `
201- Then STDOUT should be:
259+ When I try `wp transient get foo4 --network `
260+ Then STDERR should be:
202261 """
203- Success: Transient added.
262+ Warning: Transient with key "foo4" is not set.
263+ """
264+
265+ When I try `wp --url=example.com/foo transient get foo5 --network`
266+ Then STDERR should be:
267+ """
268+ Warning: Transient with key "foo5" is not set.
204269 """
205270
271+ When I try `wp --url=example.com/foo transient get foo6 --network`
272+ Then STDERR should be:
273+ """
274+ Warning: Transient with key "foo6" is not set.
275+ """
276+
277+ Scenario : Deleting expired transients on multisite
278+ Given a WP multisite install
279+ And I run `wp site create --slug=foo`
280+
281+ When I run `wp transient set foo bar 60`
282+ And I run `wp transient set foo2 bar2 60`
283+ And I run `wp transient set foo3 bar3 60 --network`
284+ And I run `wp transient set foo4 bar4 60 --network`
285+ And I run `wp --url=example.com/foo transient set foo5 bar5 60 --network`
286+ And I run `wp --url=example.com/foo transient set foo6 bar6 60 --network`
206287 # Change timeout to be in the past.
207- When I run `wp option update _transient_timeout_foo 1321009871`
288+ And I run `wp option update _transient_timeout_foo 1321009871`
289+ And I run `wp option update _site_transient_timeout_foo3 1321009871`
290+ And I run `wp --url=example.com/foo option update _site_transient_timeout_foo5 1321009871`
208291 And I run `wp transient delete --expired`
209292 Then STDOUT should be:
210293 """
@@ -217,38 +300,74 @@ Feature: Manage WordPress transient cache
217300 Warning: Transient with key "foo" is not set.
218301 """
219302
220- When I run `wp transient set foo bar 60 --network `
303+ When I run `wp transient get foo2 `
221304 Then STDOUT should be:
222305 """
223- Success: Transient added.
306+ bar2
224307 """
225308
226- # Change timeout to be in the past.
227- When I run `wp site option update _site_transient_timeout_foo 1321009871`
228- And I run `wp transient delete --expired --network`
309+ When I run `wp transient get foo3 --network`
229310 Then STDOUT should be:
230311 """
231- Success: 1 expired transient deleted from the database.
312+ bar3
232313 """
233314
234- When I try `wp transient get foo --network`
315+ When I run `wp transient get foo4 --network`
316+ Then STDOUT should be:
317+ """
318+ bar4
319+ """
320+
321+ When I run `wp --url=example.com/foo transient get foo5 --network`
322+ Then STDOUT should be:
323+ """
324+ bar5
325+ """
326+
327+ When I run `wp --url=example.com/foo transient get foo6 --network`
328+ Then STDOUT should be:
329+ """
330+ bar6
331+ """
332+
333+ When I run `wp transient delete --expired --network`
334+ Then STDOUT should be:
335+ """
336+ Success: 2 expired transients deleted from the database.
337+ """
338+
339+ When I try `wp transient get foo`
235340 Then STDERR should be:
236341 """
237342 Warning: Transient with key "foo" is not set.
238343 """
239344
240- When I run `wp transient set foo bar`
241- And I run `wp transient set foo2 bar2 600`
242- And I run `wp transient set foo3 bar3 --network`
243- And I run `wp transient set foo4 bar4 600 --network`
244- And I run `wp transient delete --all`
345+ When I run `wp transient get foo2`
245346 Then STDOUT should be:
246347 """
247- Success: 2 transients deleted from the database.
348+ bar2
349+ """
350+
351+ When I try `wp transient get foo3 --network`
352+ Then STDERR should be:
353+ """
354+ Warning: Transient with key "foo3" is not set.
248355 """
249356
250- When I run `wp transient delete --all --network`
357+ When I run `wp transient get foo4 --network`
251358 Then STDOUT should be:
252359 """
253- Success: 2 transients deleted from the database.
360+ bar4
361+ """
362+
363+ When I try `wp --url=example.com/foo transient get foo5 --network`
364+ Then STDERR should be:
365+ """
366+ Warning: Transient with key "foo5" is not set.
367+ """
368+
369+ When I run `wp --url=example.com/foo transient get foo6 --network`
370+ Then STDOUT should be:
371+ """
372+ bar6
254373 """
0 commit comments