Support an empty string passed as a status in WP_Comment_Query.

The changes in [30084] broke backward compatibility with interfaces that
manually passed an empty string for the value of 'status', such as on
wp-admin/edit-comments.php.

Fixes #29612.

git-svn-id: https://develop.svn.wordpress.org/trunk@30093 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2014-10-29 19:50:31 +00:00
parent ed19e5a1f3
commit 555d7347f9
2 changed files with 18 additions and 3 deletions
+17
View File
@@ -15,6 +15,23 @@ class Tests_Comment_Query extends WP_UnitTestCase {
$this->post_id = $this->factory->post->create();
}
/**
* @ticket 29612
*/
public function test_status_empty_string() {
$c1 = $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' => '0' ) );
$c3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'comment_approved' => 'spam' ) );
$q = new WP_Comment_Query();
$found = $q->query( array(
'status' => '',
'fields' => 'ids',
) );
$this->assertEqualSets( array( $c1, $c2 ), $found );
}
/**
* @ticket 21101
*/