Skip to content

Commit 4ba6fff

Browse files
committed
Fix comment test
Approving an approved comment works in SQLite
1 parent 897a387 commit 4ba6fff

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

features/comment.feature

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ Feature: Manage WordPress comments
158158
total_comments: 1
159159
"""
160160

161+
@require-mysql
161162
Scenario: Approving/unapproving comments
162163
Given I run `wp comment create --comment_post_ID=1 --comment_approved=0 --porcelain`
163164
And save STDOUT as {COMMENT_ID}
@@ -218,6 +219,66 @@ Feature: Manage WordPress comments
218219
"""
219220
And the return code should be 0
220221

222+
# Approving an approved comment works in SQLite
223+
@require-sqlite
224+
Scenario: Approving/unapproving comments
225+
Given I run `wp comment create --comment_post_ID=1 --comment_approved=0 --porcelain`
226+
And save STDOUT as {COMMENT_ID}
227+
228+
# With site url set.
229+
When I run `wp comment approve {COMMENT_ID} --url=www.example.com`
230+
Then STDOUT should be:
231+
"""
232+
Success: Approved comment {COMMENT_ID}.
233+
"""
234+
235+
When I try the previous command again
236+
Then STDOUT should be:
237+
"""
238+
Success: Approved comment {COMMENT_ID}.
239+
"""
240+
241+
When I run `wp comment get --field=comment_approved {COMMENT_ID}`
242+
Then STDOUT should be:
243+
"""
244+
1
245+
"""
246+
247+
When I run `wp comment unapprove {COMMENT_ID} --url=www.example.com`
248+
Then STDOUT should be:
249+
"""
250+
Success: Unapproved comment {COMMENT_ID}.
251+
"""
252+
253+
When I run `wp comment get --field=comment_approved {COMMENT_ID}`
254+
Then STDOUT should be:
255+
"""
256+
0
257+
"""
258+
259+
# Without site url set.
260+
When I try `wp comment approve {COMMENT_ID}`
261+
Then STDOUT should be:
262+
"""
263+
Success: Approved comment {COMMENT_ID}.
264+
"""
265+
And STDERR should be:
266+
"""
267+
Warning: Site url not set - defaulting to 'example.com'. Any notification emails sent to post author may appear to come from 'example.com'.
268+
"""
269+
And the return code should be 0
270+
271+
When I try `wp comment unapprove {COMMENT_ID}`
272+
Then STDOUT should be:
273+
"""
274+
Success: Unapproved comment {COMMENT_ID}.
275+
"""
276+
And STDERR should be:
277+
"""
278+
Warning: Site url not set - defaulting to 'example.com'. Any notification emails sent to post author may appear to come from 'example.com'.
279+
"""
280+
And the return code should be 0
281+
221282
Scenario: Approving/unapproving comments with multidigit comment ID
222283
Given I run `wp comment delete $(wp comment list --field=ID)`
223284
And I run `wp comment generate --count=10 --quiet`

0 commit comments

Comments
 (0)