Changeset 36345
- Timestamp:
- 01/19/2016 02:54:28 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-comment-query.php
r36327 r36345 746 746 } 747 747 748 if ( '' !== $this->query_vars['search'] ) { 748 // Falsy search strings are ignored. 749 if ( strlen( $this->query_vars['search'] ) ) { 749 750 $search_sql = $this->get_search_sql( 750 751 $this->query_vars['search'], -
trunk/tests/phpunit/tests/comment/query.php
r36326 r36345 1180 1180 } 1181 1181 1182 /** 1183 * @ticket 35513 1184 */ 1185 public function test_search_false_should_be_ignored() { 1186 $q = new WP_Comment_Query(); 1187 $q->query( array( 1188 'search' => false, 1189 ) ); 1190 $this->assertNotContains( "comment_author LIKE", $q->request ); 1191 } 1192 1193 /** 1194 * @ticket 35513 1195 */ 1196 public function test_search_null_should_be_ignored() { 1197 $q = new WP_Comment_Query(); 1198 $q->query( array( 1199 'search' => null, 1200 ) ); 1201 $this->assertNotContains( "comment_author LIKE", $q->request ); 1202 } 1203 1204 /** 1205 * @ticket 35513 1206 */ 1207 public function test_search_empty_string_should_be_ignored() { 1208 $q = new WP_Comment_Query(); 1209 $q->query( array( 1210 'search' => false, 1211 ) ); 1212 $this->assertNotContains( "comment_author LIKE", $q->request ); 1213 } 1214 1215 /** 1216 * @ticket 35513 1217 */ 1218 public function test_search_int_0_should_not_be_ignored() { 1219 $q = new WP_Comment_Query(); 1220 $q->query( array( 1221 'search' => 0, 1222 ) ); 1223 $this->assertContains( "comment_author LIKE '%0%'", $q->request ); 1224 } 1225 1226 /** 1227 * @ticket 35513 1228 */ 1229 public function test_search_string_0_should_not_be_ignored() { 1230 $q = new WP_Comment_Query(); 1231 $q->query( array( 1232 'search' => '0', 1233 ) ); 1234 $this->assertContains( "comment_author LIKE '%0%'", $q->request ); 1235 } 1236 1182 1237 public function test_orderby_default() { 1183 1238 global $wpdb;
Note: See TracChangeset
for help on using the changeset viewer.