mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-04 17:20:07 +00:00
WP_Comment_Query: add comment__in to allowed values for $orderby.
Adds unit tests. Fixes #33883. git-svn-id: https://develop.svn.wordpress.org/trunk@34212 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1837,4 +1837,38 @@ class Tests_Comment_Query extends WP_UnitTestCase {
|
||||
|
||||
$this->assertEqualSets( array( $c1, $c2 ), $ids->comments );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 33883
|
||||
*/
|
||||
public function test_orderby_comment__in() {
|
||||
$this->factory->comment->create( array(
|
||||
'comment_post_ID' => $this->post_id,
|
||||
'comment_approved' => '1'
|
||||
) );
|
||||
|
||||
$c2 = $this->factory->comment->create( array(
|
||||
'comment_post_ID' => $this->post_id,
|
||||
'comment_approved' => '1'
|
||||
) );
|
||||
$c3 = $this->factory->comment->create( array(
|
||||
'comment_post_ID' => $this->post_id,
|
||||
'comment_approved' => '1'
|
||||
) );
|
||||
|
||||
$this->factory->comment->create( array(
|
||||
'comment_post_ID' => $this->post_id,
|
||||
'comment_approved' => '1'
|
||||
) );
|
||||
|
||||
|
||||
$ids = new WP_Comment_Query( array(
|
||||
'fields' => 'ids',
|
||||
'comment__in' => array( $c2, $c3 ),
|
||||
'orderby' => 'comment__in'
|
||||
) );
|
||||
|
||||
$this->assertEquals( array( $c2, $c3 ), $ids->comments );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user