11Feature : List WordPress options
22
3- Scenario : Using the `--transients` flag
3+ # Scenario: Using the `--transients` flag
4+ # Given a WP install
5+ # And I run `wp transient set wp_transient_flag wp_transient_flag`
6+
7+ # When I run `wp option list --no-transients`
8+ # Then STDOUT should not contain:
9+ # """
10+ # wp_transient_flag
11+ # """
12+ # And STDOUT should not contain:
13+ # """
14+ # _transient
15+ # """
16+ # And STDOUT should contain:
17+ # """
18+ # siteurl
19+ # """
20+
21+ # When I run `wp option list --transients`
22+ # Then STDOUT should contain:
23+ # """
24+ # wp_transient_flag
25+ # """
26+ # And STDOUT should contain:
27+ # """
28+ # _transient
29+ # """
30+ # And STDOUT should not contain:
31+ # """
32+ # siteurl
33+ # """
34+
35+ # Scenario: List option with exclude pattern
36+ # Given a WP install
37+
38+ # When I run `wp option add sample_test_field_one sample_test_field_value_one`
39+ # And I run `wp option add sample_test_field_two sample_test_field_value_two`
40+ # And I run `wp option list --search="sample_test_field_*" --format=csv`
41+ # Then STDOUT should be:
42+ # """
43+ # option_name,option_value
44+ # sample_test_field_one,sample_test_field_value_one
45+ # sample_test_field_two,sample_test_field_value_two
46+ # """
47+
48+ # When I run `wp option list --search="sample_test_field_*" --exclude="*field_one" --format=csv`
49+ # Then STDOUT should be:
50+ # """
51+ # option_name,option_value
52+ # sample_test_field_two,sample_test_field_value_two
53+ # """
54+
55+ # When I run `wp option list`
56+ # Then STDOUT should contain:
57+ # """
58+ # sample_test_field_one
59+ # """
60+
61+ # When I run `wp option list --exclude="sample_test_field_one"`
62+ # Then STDOUT should not contain:
63+ # """
64+ # sample_test_field_one
65+ # """
66+
67+ # Scenario: List option with sorting option
68+ # Given a WP install
69+ # And I run `wp option add sample_test_field_one sample_test_field_value_one`
70+ # And I run `wp option add sample_test_field_two sample_test_field_value_two`
71+
72+ # When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_id --order=asc`
73+ # Then STDOUT should be:
74+ # """
75+ # option_name,option_value
76+ # sample_test_field_one,sample_test_field_value_one
77+ # sample_test_field_two,sample_test_field_value_two
78+ # """
79+
80+ # When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_id --order=desc`
81+ # Then STDOUT should be:
82+ # """
83+ # option_name,option_value
84+ # sample_test_field_two,sample_test_field_value_two
85+ # sample_test_field_one,sample_test_field_value_one
86+ # """
87+
88+ # When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_name --order=asc`
89+ # Then STDOUT should be:
90+ # """
91+ # option_name,option_value
92+ # sample_test_field_one,sample_test_field_value_one
93+ # sample_test_field_two,sample_test_field_value_two
94+ # """
95+
96+ # When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_name --order=desc`
97+ # Then STDOUT should be:
98+ # """
99+ # option_name,option_value
100+ # sample_test_field_two,sample_test_field_value_two
101+ # sample_test_field_one,sample_test_field_value_one
102+ # """
103+
104+ # When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_value --order=asc`
105+ # Then STDOUT should be:
106+ # """
107+ # option_name,option_value
108+ # sample_test_field_one,sample_test_field_value_one
109+ # sample_test_field_two,sample_test_field_value_two
110+ # """
111+
112+ # When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_value --order=desc`
113+ # Then STDOUT should be:
114+ # """
115+ # option_name,option_value
116+ # sample_test_field_two,sample_test_field_value_two
117+ # sample_test_field_one,sample_test_field_value_one
118+ # """
119+
120+ # Scenario: Default list option without transient
121+ # Given a WP install
122+ # And I run `wp transient set wp_transient_flag wp_transient_flag`
123+
124+ # When I run `wp option list`
125+ # Then STDOUT should not contain:
126+ # """
127+ # wp_transient_flag
128+ # """
129+ # And STDOUT should not contain:
130+ # """
131+ # _transient
132+ # """
133+ # And STDOUT should contain:
134+ # """
135+ # siteurl
136+ # """
137+
138+ # Scenario: Using the `--unserialize` flag
139+ # Given a WP install
140+
141+ # When I run `wp option add --format=json sample_test_field_one '{"value": 1}'`
142+ # And I run `wp option list --search="sample_test_field_*" --format=yaml --unserialize`
143+ # Then STDOUT should be:
144+ # """
145+ # ---
146+ # -
147+ # option_name: sample_test_field_one
148+ # option_value:
149+ # value: 1
150+ # """
151+ Scenario : Using the `--autoload=on` flag
4152 Given a WP install
5- And I run `wp transient set wp_transient_flag wp_transient_flag`
153+ And I run `wp option add sample_autoload_one 'sample_value_one' --autoload=yes`
154+ And I run `wp option add sample_autoload_two 'sample_value_two' --autoload=no`
155+ And I run `wp option add sample_autoload_three 'sample_value_three' --autoload=on`
156+ And I run `wp option add sample_autoload_four 'sample_value_four' --autoload=off`
6157
7- When I run `wp option list --no-transients `
158+ When I run `wp option list --autoload=on `
8159 Then STDOUT should not contain:
9160 """
10- wp_transient_flag
161+ sample_value_two
11162 """
12163 And STDOUT should not contain:
13164 """
14- _transient
165+ sample_value_four
15166 """
16167 And STDOUT should contain:
17168 """
18- siteurl
19- """
20-
21- When I run `wp option list --transients`
22- Then STDOUT should contain:
23- """
24- wp_transient_flag
169+ sample_value_one
25170 """
26171 And STDOUT should contain:
27172 """
28- _transient
29- """
30- And STDOUT should not contain:
31- """
32- siteurl
173+ sample_value_three
33174 """
34-
35- Scenario : List option with exclude pattern
175+ Scenario : Using the `--autoload=off` flag
36176 Given a WP install
177+ And I run `wp option add sample_autoload_one 'sample_value_one' --autoload=yes`
178+ And I run `wp option add sample_autoload_two 'sample_value_two' --autoload=no`
179+ And I run `wp option add sample_autoload_three 'sample_value_three' --autoload=on`
180+ And I run `wp option add sample_autoload_four 'sample_value_four' --autoload=off`
37181
38- When I run `wp option add sample_test_field_one sample_test_field_value_one`
39- And I run `wp option add sample_test_field_two sample_test_field_value_two`
40- And I run `wp option list --search="sample_test_field_*" --format=csv`
41- Then STDOUT should be:
42- """
43- option_name,option_value
44- sample_test_field_one,sample_test_field_value_one
45- sample_test_field_two,sample_test_field_value_two
46- """
47-
48- When I run `wp option list --search="sample_test_field_*" --exclude="*field_one" --format=csv`
49- Then STDOUT should be:
50- """
51- option_name,option_value
52- sample_test_field_two,sample_test_field_value_two
53- """
54-
55- When I run `wp option list`
56- Then STDOUT should contain:
57- """
58- sample_test_field_one
59- """
60-
61- When I run `wp option list --exclude="sample_test_field_one" `
182+ When I run `wp option list --autoload=off`
62183 Then STDOUT should not contain:
63184 """
64- sample_test_field_one
65- """
66-
67- Scenario : List option with sorting option
68- Given a WP install
69- And I run `wp option add sample_test_field_one sample_test_field_value_one`
70- And I run `wp option add sample_test_field_two sample_test_field_value_two`
71-
72- When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_id --order=asc`
73- Then STDOUT should be:
74- """
75- option_name,option_value
76- sample_test_field_one,sample_test_field_value_one
77- sample_test_field_two,sample_test_field_value_two
78- """
79-
80- When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_id --order=desc`
81- Then STDOUT should be:
82- """
83- option_name,option_value
84- sample_test_field_two,sample_test_field_value_two
85- sample_test_field_one,sample_test_field_value_one
86- """
87-
88- When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_name --order=asc`
89- Then STDOUT should be:
90- """
91- option_name,option_value
92- sample_test_field_one,sample_test_field_value_one
93- sample_test_field_two,sample_test_field_value_two
94- """
95-
96- When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_name --order=desc`
97- Then STDOUT should be:
98- """
99- option_name,option_value
100- sample_test_field_two,sample_test_field_value_two
101- sample_test_field_one,sample_test_field_value_one
102- """
103-
104- When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_value --order=asc`
105- Then STDOUT should be:
106- """
107- option_name,option_value
108- sample_test_field_one,sample_test_field_value_one
109- sample_test_field_two,sample_test_field_value_two
110- """
111-
112- When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_value --order=desc`
113- Then STDOUT should be:
114- """
115- option_name,option_value
116- sample_test_field_two,sample_test_field_value_two
117- sample_test_field_one,sample_test_field_value_one
118- """
119-
120- Scenario : Default list option without transient
121- Given a WP install
122- And I run `wp transient set wp_transient_flag wp_transient_flag`
123-
124- When I run `wp option list`
125- Then STDOUT should not contain:
126- """
127- wp_transient_flag
185+ sample_value_one
128186 """
129187 And STDOUT should not contain:
130188 """
131- _transient
189+ sample_value_three
132190 """
133191 And STDOUT should contain:
134192 """
135- siteurl
193+ sample_value_two
136194 """
137-
138- Scenario : Using the `--unserialize` flag
139- Given a WP install
140-
141- When I run `wp option add --format=json sample_test_field_one '{"value": 1}' `
142- And I run `wp option list --search="sample_test_field_*" --format=yaml --unserialize`
143- Then STDOUT should be:
144- """
145- ---
146- -
147- option_name: sample_test_field_one
148- option_value:
149- value: 1
195+ And STDOUT should contain:
150196 """
197+ sample_value_four
198+ """
0 commit comments