Changeset 30402
- Timestamp:
- 11/20/2014 01:51:38 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment.php
r30281 r30402 137 137 * argument is true. 138 138 */ 139 function get_approved_comments( $post_id = 0, $args = array() ) { 139 function get_approved_comments( $post_id, $args = array() ) { 140 if ( ! $post_id ) { 141 return array(); 142 } 143 140 144 $defaults = array( 141 145 'status' => 1, -
trunk/tests/phpunit/tests/comment.php
r30098 r30402 31 31 $this->assertEquals( array( $ca1, $ca2, $c2, $c3, $c4, $c5 ), wp_list_pluck( $found, 'comment_ID' ) ); 32 32 } 33 34 /** 35 * @ticket 30412 36 */ 37 public function test_get_approved_comments_with_post_id_0_should_return_empty_array() { 38 $p = $this->factory->post->create(); 39 $ca1 = $this->factory->comment->create( array( 'comment_post_ID' => $p, 'comment_approved' => '1' ) ); 40 41 $found = get_approved_comments( 0 ); 42 43 $this->assertSame( array(), $found ); 44 } 33 45 } -
trunk/tests/phpunit/tests/comment/query.php
r30266 r30402 29 29 30 30 $this->assertEqualSets( array( $c1, $c2, $c3, $c4, $c5 ), $found ); 31 } 32 33 public function test_query_post_id_0() { 34 $c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => '1' ) ); 35 36 $q = new WP_Comment_Query(); 37 $found = $q->query( array( 38 'post_id' => 0, 39 'fields' => 'ids', 40 ) ); 41 42 $this->assertEqualSets( array( $c1 ), $found ); 31 43 } 32 44
Note: See TracChangeset
for help on using the changeset viewer.