mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Introduce $comment_status and $ping_status params for WP_Query.
Props birgire. Fixes #35601. git-svn-id: https://develop.svn.wordpress.org/trunk@36403 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -492,4 +492,34 @@ class Tests_Query extends WP_UnitTestCase {
|
||||
|
||||
$this->assertContains( 'LIMIT 5, 5', $q->request );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35601
|
||||
*/
|
||||
public function test_comment_status() {
|
||||
$p1 = self::factory()->post->create( array( 'comment_status' => 'open' ) );
|
||||
$p2 = self::factory()->post->create( array( 'comment_status' => 'closed' ) );
|
||||
|
||||
$q = new WP_Query( array(
|
||||
'fields' => 'ids',
|
||||
'comment_status' => 'closed',
|
||||
) );
|
||||
|
||||
$this->assertSame( array( $p2 ), $q->posts );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35601
|
||||
*/
|
||||
public function test_ping_status() {
|
||||
$p1 = self::factory()->post->create( array( 'ping_status' => 'open' ) );
|
||||
$p2 = self::factory()->post->create( array( 'ping_status' => 'closed' ) );
|
||||
|
||||
$q = new WP_Query( array(
|
||||
'fields' => 'ids',
|
||||
'ping_status' => 'closed',
|
||||
) );
|
||||
|
||||
$this->assertSame( array( $p2 ), $q->posts );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user