@@ -293,6 +293,25 @@ public function test_wp_notify_moderator_should_not_throw_notice_when_post_autho
293
293
$ this ->assertTrue ( wp_notify_moderator ( $ c ) );
294
294
}
295
295
296
+ public function test_wp_new_comment_notify_postauthor_should_send_email_when_comment_is_approved () {
297
+ $ c = self ::factory ()->comment ->create ( array (
298
+ 'comment_post_ID ' => self ::$ post_id ,
299
+ ) );
300
+
301
+ $ sent = wp_new_comment_notify_postauthor ( $ c );
302
+ $ this ->assertTrue ( $ sent );
303
+ }
304
+
305
+ public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_is_unapproved () {
306
+ $ c = self ::factory ()->comment ->create ( array (
307
+ 'comment_post_ID ' => self ::$ post_id ,
308
+ 'comment_approved ' => '0 ' ,
309
+ ) );
310
+
311
+ $ sent = wp_new_comment_notify_postauthor ( $ c );
312
+ $ this ->assertFalse ( $ sent );
313
+ }
314
+
296
315
/**
297
316
* @ticket 33587
298
317
*/
@@ -306,6 +325,19 @@ public function test_wp_new_comment_notify_postauthor_should_not_send_email_when
306
325
$ this ->assertFalse ( $ sent );
307
326
}
308
327
328
+ /**
329
+ * @ticket 35006
330
+ */
331
+ public function test_wp_new_comment_notify_postauthor_should_not_send_email_when_comment_has_been_trashed () {
332
+ $ c = self ::factory ()->comment ->create ( array (
333
+ 'comment_post_ID ' => self ::$ post_id ,
334
+ 'comment_approved ' => 'trash ' ,
335
+ ) );
336
+
337
+ $ sent = wp_new_comment_notify_postauthor ( $ c );
338
+ $ this ->assertFalse ( $ sent );
339
+ }
340
+
309
341
/**
310
342
* @ticket 12431
311
343
*/
0 commit comments