| | 114 | |
| | 115 | function test_get_status() { |
| | 116 | $post_id = $this->factory->post->create(); |
| | 117 | $this->factory->comment->create_post_comments( $post_id, 10 ); |
| | 118 | |
| | 119 | $post_id2 = $this->factory->post->create(); |
| | 120 | $this->factory->comment->create_post_comments( $post_id2, 10 ); |
| | 121 | |
| | 122 | $post_id3 = $this->factory->post->create(); |
| | 123 | $this->factory->comment->create_post_comments( $post_id3, 10, array( 'comment_approved' => '0' ) ); |
| | 124 | |
| | 125 | $post_id4 = $this->factory->post->create(); |
| | 126 | $this->factory->comment->create_post_comments( $post_id4, 10, array( 'comment_approved' => 'trash' ) ); |
| | 127 | |
| | 128 | $post_id5 = $this->factory->post->create(); |
| | 129 | $this->factory->comment->create_post_comments( $post_id5, 10, array( 'comment_approved' => 'spam' ) ); |
| | 130 | |
| | 131 | $this->assertEquals( 30, count( get_comments() ) ); |
| | 132 | $this->assertEquals( 30, count( get_comments( array( 'status' => 'all' ) ) ) ); |
| | 133 | $this->assertEquals( 50, count( get_comments( array( 'status' => 'full' ) ) ) ); |
| | 134 | $this->assertEquals( 20, count( get_comments( array( 'status' => 'approve' ) ) ) ); |
| | 135 | $this->assertEquals( 10, count( get_comments( array( 'status' => 'hold' ) ) ) ); |
| | 136 | $this->assertEquals( 10, count( get_comments( array( 'status' => 'trash' ) ) ) ); |
| | 137 | $this->assertEquals( 10, count( get_comments( array( 'status' => 'spam' ) ) ) ); |
| | 138 | } |