mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Ignore false values of 'search' in WP_Comment_Query.
Props danielbachhuber. Fixes #35513. git-svn-id: https://develop.svn.wordpress.org/trunk@36345 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1179,6 +1179,61 @@ class Tests_Comment_Query extends WP_UnitTestCase {
|
||||
$this->assertEqualSets( array( $c1, $c2, $c3, $c4, $c5 ), $found );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35513
|
||||
*/
|
||||
public function test_search_false_should_be_ignored() {
|
||||
$q = new WP_Comment_Query();
|
||||
$q->query( array(
|
||||
'search' => false,
|
||||
) );
|
||||
$this->assertNotContains( "comment_author LIKE", $q->request );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35513
|
||||
*/
|
||||
public function test_search_null_should_be_ignored() {
|
||||
$q = new WP_Comment_Query();
|
||||
$q->query( array(
|
||||
'search' => null,
|
||||
) );
|
||||
$this->assertNotContains( "comment_author LIKE", $q->request );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35513
|
||||
*/
|
||||
public function test_search_empty_string_should_be_ignored() {
|
||||
$q = new WP_Comment_Query();
|
||||
$q->query( array(
|
||||
'search' => false,
|
||||
) );
|
||||
$this->assertNotContains( "comment_author LIKE", $q->request );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35513
|
||||
*/
|
||||
public function test_search_int_0_should_not_be_ignored() {
|
||||
$q = new WP_Comment_Query();
|
||||
$q->query( array(
|
||||
'search' => 0,
|
||||
) );
|
||||
$this->assertContains( "comment_author LIKE '%0%'", $q->request );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 35513
|
||||
*/
|
||||
public function test_search_string_0_should_not_be_ignored() {
|
||||
$q = new WP_Comment_Query();
|
||||
$q->query( array(
|
||||
'search' => '0',
|
||||
) );
|
||||
$this->assertContains( "comment_author LIKE '%0%'", $q->request );
|
||||
}
|
||||
|
||||
public function test_orderby_default() {
|
||||
global $wpdb;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user