-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathoption-list.feature
More file actions
201 lines (178 loc) · 5.91 KB
/
option-list.feature
File metadata and controls
201 lines (178 loc) · 5.91 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
Feature: List WordPress options
@skip-object-cache
Scenario: Using the `--transients` flag
Given a WP install
And I run `wp transient set wp_transient_flag wp_transient_flag`
When I run `wp option list --no-transients`
Then STDOUT should not contain:
"""
wp_transient_flag
"""
And STDOUT should not contain:
"""
_transient
"""
And STDOUT should contain:
"""
siteurl
"""
When I run `wp option list --transients`
Then STDOUT should contain:
"""
wp_transient_flag
"""
And STDOUT should contain:
"""
_transient
"""
And STDOUT should not contain:
"""
siteurl
"""
Scenario: List option with exclude pattern
Given a WP install
When I run `wp option add sample_test_field_one sample_test_field_value_one`
And I run `wp option add sample_test_field_two sample_test_field_value_two`
And I run `wp option list --search="sample_test_field_*" --format=csv`
Then STDOUT should be:
"""
option_name,option_value
sample_test_field_one,sample_test_field_value_one
sample_test_field_two,sample_test_field_value_two
"""
When I run `wp option list --search="sample_test_field_*" --exclude="*field_one" --format=csv`
Then STDOUT should be:
"""
option_name,option_value
sample_test_field_two,sample_test_field_value_two
"""
When I run `wp option list`
Then STDOUT should contain:
"""
sample_test_field_one
"""
When I run `wp option list --exclude="sample_test_field_one"`
Then STDOUT should not contain:
"""
sample_test_field_one
"""
Scenario: List option with sorting option
Given a WP install
And I run `wp option add sample_test_field_one sample_test_field_value_one`
And I run `wp option add sample_test_field_two sample_test_field_value_two`
When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_id --order=asc`
Then STDOUT should be:
"""
option_name,option_value
sample_test_field_one,sample_test_field_value_one
sample_test_field_two,sample_test_field_value_two
"""
When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_id --order=desc`
Then STDOUT should be:
"""
option_name,option_value
sample_test_field_two,sample_test_field_value_two
sample_test_field_one,sample_test_field_value_one
"""
When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_name --order=asc`
Then STDOUT should be:
"""
option_name,option_value
sample_test_field_one,sample_test_field_value_one
sample_test_field_two,sample_test_field_value_two
"""
When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_name --order=desc`
Then STDOUT should be:
"""
option_name,option_value
sample_test_field_two,sample_test_field_value_two
sample_test_field_one,sample_test_field_value_one
"""
When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_value --order=asc`
Then STDOUT should be:
"""
option_name,option_value
sample_test_field_one,sample_test_field_value_one
sample_test_field_two,sample_test_field_value_two
"""
When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_value --order=desc`
Then STDOUT should be:
"""
option_name,option_value
sample_test_field_two,sample_test_field_value_two
sample_test_field_one,sample_test_field_value_one
"""
Scenario: Default list option without transient
Given a WP install
And I run `wp transient set wp_transient_flag wp_transient_flag`
When I run `wp option list`
Then STDOUT should not contain:
"""
wp_transient_flag
"""
And STDOUT should not contain:
"""
_transient
"""
And STDOUT should contain:
"""
siteurl
"""
Scenario: Using the `--unserialize` flag
Given a WP install
When I run `wp option add --format=json sample_test_field_one '{"value": 1}'`
And I run `wp option list --search="sample_test_field_*" --format=yaml --unserialize`
Then STDOUT should be:
"""
---
-
option_name: sample_test_field_one
option_value:
value: 1
"""
Scenario: Using the `--autoload=on` flag
Given a WP install
And I run `wp option add sample_autoload_one 'sample_value_one' --autoload=yes`
And I run `wp option add sample_autoload_two 'sample_value_two' --autoload=no`
And I run `wp option add sample_autoload_three 'sample_value_three' --autoload=on`
And I run `wp option add sample_autoload_four 'sample_value_four' --autoload=off`
When I run `wp option list --autoload=on`
Then STDOUT should not contain:
"""
sample_value_two
"""
And STDOUT should not contain:
"""
sample_value_four
"""
And STDOUT should contain:
"""
sample_value_one
"""
And STDOUT should contain:
"""
sample_value_three
"""
Scenario: Using the `--autoload=off` flag
Given a WP install
And I run `wp option add sample_autoload_one 'sample_value_one' --autoload=yes`
And I run `wp option add sample_autoload_two 'sample_value_two' --autoload=no`
And I run `wp option add sample_autoload_three 'sample_value_three' --autoload=on`
And I run `wp option add sample_autoload_four 'sample_value_four' --autoload=off`
When I run `wp option list --autoload=off`
Then STDOUT should not contain:
"""
sample_value_one
"""
And STDOUT should not contain:
"""
sample_value_three
"""
And STDOUT should contain:
"""
sample_value_two
"""
And STDOUT should contain:
"""
sample_value_four
"""