Changeset 37609 for trunk/tests/phpunit/tests/comment.php
- Timestamp:
- 06/01/2016 05:15:27 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment.php
r37358 r37609 688 688 } 689 689 } 690 691 public function test_update_should_invalidate_comment_cache() { 692 global $wpdb; 693 694 $c = self::factory()->comment->create( array( 'comment_author' => 'Foo' ) ); 695 696 $comment = get_comment( $c ); 697 $this->assertSame( 'Foo', $comment->comment_author ); 698 699 wp_update_comment( array( 700 'comment_ID' => $c, 701 'comment_author' => 'Bar', 702 ) ); 703 704 $comment = get_comment( $c ); 705 706 $this->assertSame( 'Bar', $comment->comment_author ); 707 } 708 709 public function test_trash_should_invalidate_comment_cache() { 710 global $wpdb; 711 712 $c = self::factory()->comment->create(); 713 714 $comment = get_comment( $c ); 715 716 wp_trash_comment( $c ); 717 718 $comment = get_comment( $c ); 719 720 $this->assertSame( 'trash', $comment->comment_approved ); 721 } 722 723 public function test_untrash_should_invalidate_comment_cache() { 724 global $wpdb; 725 726 $c = self::factory()->comment->create(); 727 wp_trash_comment( $c ); 728 729 $comment = get_comment( $c ); 730 $this->assertSame( 'trash', $comment->comment_approved ); 731 732 wp_untrash_comment( $c ); 733 734 $comment = get_comment( $c ); 735 736 $this->assertSame( '1', $comment->comment_approved ); 737 } 738 739 public function test_spam_should_invalidate_comment_cache() { 740 global $wpdb; 741 742 $c = self::factory()->comment->create(); 743 744 $comment = get_comment( $c ); 745 746 wp_spam_comment( $c ); 747 748 $comment = get_comment( $c ); 749 750 $this->assertSame( 'spam', $comment->comment_approved ); 751 } 752 753 public function test_unspam_should_invalidate_comment_cache() { 754 global $wpdb; 755 756 $c = self::factory()->comment->create(); 757 wp_spam_comment( $c ); 758 759 $comment = get_comment( $c ); 760 $this->assertSame( 'spam', $comment->comment_approved ); 761 762 wp_unspam_comment( $c ); 763 764 $comment = get_comment( $c ); 765 766 $this->assertSame( '1', $comment->comment_approved ); 767 } 690 768 }
Note: See TracChangeset
for help on using the changeset viewer.