-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathpost-generate.feature
More file actions
198 lines (169 loc) · 5.71 KB
/
post-generate.feature
File metadata and controls
198 lines (169 loc) · 5.71 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
Feature: Generate new WordPress posts
Background:
Given a WP install
Scenario: Generating posts
When I run `echo "Content generated by wp post generate" | wp post generate --count=1 --post_content`
And I run `wp post list --field=post_content`
Then STDOUT should contain:
"""
Content generated by wp post generate
"""
And STDERR should be empty
@broken
Scenario: Using --post-content requires STDIN input
When I try `wp post generate --count=1 --post_content`
Then STDERR should contain:
"""
Error: The parameter `post_content` reads from STDIN.
"""
Scenario: Generating posts by a specific author
When I run `wp user create dummyuser dummy@example.com --porcelain`
Then save STDOUT as {AUTHOR_ID}
When I run `wp post generate --post_author={AUTHOR_ID} --post_type=post --count=16`
And I run `wp post list --post_type=post --author={AUTHOR_ID} --format=count`
Then STDOUT should contain:
"""
16
"""
Scenario: Generating pages
When I run `wp post generate --post_type=page --max_depth=10`
And I run `wp post list --post_type=page --field=post_parent`
Then STDOUT should contain:
"""
1
"""
Scenario: Generating posts and outputting ids
When I run `wp post generate --count=1 --format=ids`
Then save STDOUT as {POST_ID}
When I run `wp post update {POST_ID} --post_title="foo"`
Then STDOUT should contain:
"""
Success:
"""
Scenario: Generating post and outputting title and name
When I run `wp post generate --count=3 --post_title=Howdy!`
And I run `wp post list --field=post_title --posts_per_page=4 --orderby=ID --order=asc`
Then STDOUT should contain:
"""
Hello world!
Howdy!
Howdy! 2
Howdy! 3
"""
And STDERR should be empty
When I run `wp post list --field=post_name --posts_per_page=4 --orderby=ID --order=asc`
Then STDOUT should contain:
"""
hello-world
howdy
howdy-2
howdy-3
"""
And STDERR should be empty
Scenario: Generating posts with post_date argument without time
When I run `wp post generate --count=1 --post_date="2018-07-01"`
And I run `wp post list --field=post_date`
Then STDOUT should contain:
"""
2018-07-01 00:00:00
"""
When I run `wp post list --field=post_date_gmt`
Then STDOUT should contain:
"""
2018-07-01 00:00:00
"""
Scenario: Generating posts with post_date argument with time
When I run `wp post generate --count=1 --post_date="2018-07-02 02:21:05"`
And I run `wp post list --field=post_date`
Then STDOUT should contain:
"""
2018-07-02 02:21:05
"""
When I run `wp post list --field=post_date_gmt`
Then STDOUT should contain:
"""
2018-07-02 02:21:05
"""
Scenario: Generating posts with post_date_gmt argument without time
When I run `wp post generate --count=1 --post_date_gmt="2018-07-03"`
And I run `wp post list --field=post_date`
Then STDOUT should contain:
"""
2018-07-03 00:00:00
"""
When I run `wp post list --field=post_date_gmt`
Then STDOUT should contain:
"""
2018-07-03 00:00:00
"""
Scenario: Generating posts with post_date_gmt argument with time
When I run `wp post generate --count=1 --post_date_gmt="2018-07-04 12:34:56"`
And I run `wp post list --field=post_date`
Then STDOUT should contain:
"""
2018-07-04 12:34:56
"""
When I run `wp post list --field=post_date_gmt`
Then STDOUT should contain:
"""
2018-07-04 12:34:56
"""
Scenario: Generating posts with post_date argument with hyphenated time
When I run `wp post generate --count=1 --post_date="2018-07-05-17:17:17"`
And I run `wp post list --field=post_date`
Then STDOUT should contain:
"""
2018-07-05 17:17:17
"""
When I run `wp post list --field=post_date_gmt`
Then STDOUT should contain:
"""
2018-07-05 17:17:17
"""
Scenario: Generating posts with post_date_gmt argument with hyphenated time
When I run `wp post generate --count=1 --post_date_gmt="2018-07-06-12:12:12"`
And I run `wp post list --field=post_date`
Then STDOUT should contain:
"""
2018-07-06 12:12:12
"""
When I run `wp post list --field=post_date_gmt`
Then STDOUT should contain:
"""
2018-07-06 12:12:12
"""
Scenario: Generating posts with different post_date & post_date_gmt argument without time
When I run `wp post generate --count=1 --post_date="1999-12-31" --post_date_gmt="2000-01-01"`
And I run `wp post list --field=post_date`
Then STDOUT should contain:
"""
1999-12-31 00:00:00
"""
When I run `wp post list --field=post_date_gmt`
Then STDOUT should contain:
"""
2000-01-01 00:00:00
"""
Scenario: Generating posts with different post_date & post_date_gmt argument with time
When I run `wp post generate --count=1 --post_date="1999-12-31 11:11:00" --post_date_gmt="2000-01-01 02:11:00"`
And I run `wp post list --field=post_date`
Then STDOUT should contain:
"""
1999-12-31 11:11:00
"""
When I run `wp post list --field=post_date_gmt`
Then STDOUT should contain:
"""
2000-01-01 02:11:00
"""
Scenario: Generating posts when the site timezone is ahead of UTC
When I run `wp option update timezone_string "Europe/Helsinki"`
And I run `wp post delete 1 --force`
And I run `wp post list --field=post_status`
Then STDOUT should be empty
When I run `wp post generate --count=1`
And I run `wp post list --field=post_status`
Then STDOUT should be:
"""
publish
"""