@@ -158,6 +158,7 @@ Feature: Manage WordPress comments
158
158
total_comments: 1
159
159
"""
160
160
161
+ @require-mysql
161
162
Scenario : Approving/unapproving comments
162
163
Given I run `wp comment create --comment_post_ID=1 --comment_approved=0 --porcelain`
163
164
And save STDOUT as {COMMENT_ID}
@@ -218,6 +219,66 @@ Feature: Manage WordPress comments
218
219
"""
219
220
And the return code should be 0
220
221
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
+
221
282
Scenario : Approving/unapproving comments with multidigit comment ID
222
283
Given I run `wp comment delete $(wp comment list --field=ID)`
223
284
And I run `wp comment generate --count=10 --quiet`
0 commit comments