-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathtransient-pluck.feature
More file actions
59 lines (49 loc) · 1.59 KB
/
transient-pluck.feature
File metadata and controls
59 lines (49 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Feature: Pluck command available for the transient cache
Scenario: Nested values from transient can be retrieved at any depth.
Given a WP install
And I run `wp eval "set_transient( 'my_key', ['foo' => 'bar'] );"`
And I run `wp eval "set_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );"`
When I run `wp transient pluck my_key foo`
Then STDOUT should be:
"""
bar
"""
When I run `wp transient pluck my_key_2 foo bar`
Then STDOUT should be:
"""
baz
"""
When I run `wp transient pluck my_key_2 foo bar --format=json`
Then STDOUT should be:
"""
"baz"
"""
When I run `wp transient pluck my_key_2 foo --format=json`
Then STDOUT should be:
"""
{"bar":"baz"}
"""
When I try `wp transient pluck unknown_key foo`
Then STDERR should be:
"""
Warning: Transient with key "unknown_key" is not set.
"""
Scenario: Nested values from site transient can be retrieved at any depth.
Given a WP multisite install
And I run `wp eval "set_site_transient( 'my_key', ['foo' => 'bar'] );"`
And I run `wp eval "set_site_transient( 'my_key_2', ['foo' => ['bar' => 'baz']] );"`
When I run `wp transient pluck my_key foo --network`
Then STDOUT should be:
"""
bar
"""
When I run `wp transient pluck my_key_2 foo bar --network`
Then STDOUT should be:
"""
baz
"""
When I try `wp transient pluck unknown_key foo --network`
Then STDERR should be:
"""
Warning: Transient with key "unknown_key" is not set.
"""