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:
Boone Gorges
2016-01-26 02:55:15 +00:00
parent af5a3b663f
commit 14b6dbebd2
2 changed files with 41 additions and 0 deletions

View File

@@ -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 );
}
}