|
@@ 523-539 (lines=17) @@
|
| 520 |
|
/** |
| 521 |
|
* @ticket 761 |
| 522 |
|
*/ |
| 523 |
|
public function test_wp_notify_moderator_filter_moderation_notify_option_true_filter_false() |
| 524 |
|
{ |
| 525 |
|
$comment_data = $this->setup_notify_comment(); |
| 526 |
|
|
| 527 |
|
/** |
| 528 |
|
* Test with moderator notification setting on, filter set to off. |
| 529 |
|
* Should not send a notification. |
| 530 |
|
*/ |
| 531 |
|
update_option('moderation_notify', 1); |
| 532 |
|
add_filter('notify_moderator', '__return_false'); |
| 533 |
|
|
| 534 |
|
$notification_sent = $this->try_sending_moderator_notification($comment_data['comment'], $comment_data['post']); |
| 535 |
|
|
| 536 |
|
$this->assertFalse($notification_sent, 'Moderator notification setting on, filter set to off'); |
| 537 |
|
|
| 538 |
|
remove_filter('notify_moderator', '__return_false'); |
| 539 |
|
remove_filter('comment_flood_filter', '__return_false'); |
| 540 |
|
} |
| 541 |
|
|
| 542 |
|
/** |
|
@@ 545-561 (lines=17) @@
|
| 542 |
|
/** |
| 543 |
|
* @ticket 761 |
| 544 |
|
*/ |
| 545 |
|
public function test_wp_notify_moderator_filter_moderation_notify_option_false_filter_true() |
| 546 |
|
{ |
| 547 |
|
$comment_data = $this->setup_notify_comment(); |
| 548 |
|
|
| 549 |
|
/** |
| 550 |
|
* Test with moderator notification setting off, filter set to on. |
| 551 |
|
* Should send a notification. |
| 552 |
|
*/ |
| 553 |
|
update_option('moderation_notify', 0); |
| 554 |
|
add_filter('notify_moderator', '__return_true'); |
| 555 |
|
|
| 556 |
|
$notification_sent = $this->try_sending_moderator_notification($comment_data['comment'], $comment_data['post']); |
| 557 |
|
|
| 558 |
|
$this->assertTrue($notification_sent, 'Moderator notification setting off, filter set to on'); |
| 559 |
|
|
| 560 |
|
remove_filter('notify_moderator', '__return_true'); |
| 561 |
|
remove_filter('comment_flood_filter', '__return_false'); |
| 562 |
|
} |
| 563 |
|
|
| 564 |
|
/** |
|
@@ 567-584 (lines=18) @@
|
| 564 |
|
/** |
| 565 |
|
* @ticket 761 |
| 566 |
|
*/ |
| 567 |
|
public function test_wp_notify_post_author_filter_comments_notify_option_true_filter_false() |
| 568 |
|
{ |
| 569 |
|
|
| 570 |
|
$comment_data = $this->setup_notify_comment(); |
| 571 |
|
|
| 572 |
|
/** |
| 573 |
|
* Test with author notification setting on, filter set to off. |
| 574 |
|
* Should not send a notification. |
| 575 |
|
*/ |
| 576 |
|
update_option('comments_notify', 1); |
| 577 |
|
add_filter('notify_post_author', '__return_false'); |
| 578 |
|
|
| 579 |
|
$notification_sent = $this->try_sending_author_notification($comment_data['comment'], $comment_data['post']); |
| 580 |
|
|
| 581 |
|
$this->assertFalse($notification_sent, 'Test with author notification setting on, filter set to off'); |
| 582 |
|
|
| 583 |
|
remove_filter('notify_post_author', '__return_false'); |
| 584 |
|
remove_filter('comment_flood_filter', '__return_false'); |
| 585 |
|
} |
| 586 |
|
|
| 587 |
|
/** |
|
@@ 590-606 (lines=17) @@
|
| 587 |
|
/** |
| 588 |
|
* @ticket 761 |
| 589 |
|
*/ |
| 590 |
|
public function test_wp_notify_post_author_filter_comments_notify_option_false_filter_true() |
| 591 |
|
{ |
| 592 |
|
$comment_data = $this->setup_notify_comment(); |
| 593 |
|
|
| 594 |
|
/** |
| 595 |
|
* Test with author notification setting off, filter set to on. |
| 596 |
|
* Should send a notification. |
| 597 |
|
*/ |
| 598 |
|
update_option('comments_notify', 0); |
| 599 |
|
add_filter('notify_post_author', '__return_true'); |
| 600 |
|
|
| 601 |
|
$notification_sent = $this->try_sending_author_notification($comment_data['comment'], $comment_data['post']); |
| 602 |
|
|
| 603 |
|
$this->assertTrue($notification_sent, 'Test with author notification setting off, filter set to on'); |
| 604 |
|
|
| 605 |
|
remove_filter('notify_post_author', '__return_true'); |
| 606 |
|
remove_filter('comment_flood_filter', '__return_false'); |
| 607 |
|
} |
| 608 |
|
|
| 609 |
|
/** |