Query: Fix some code formatting issues introduced in [44452].

See #38034.



git-svn-id: https://develop.svn.wordpress.org/trunk@44456 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Gary Pendergast 2019-01-08 04:31:56 +00:00
parent ccc55debda
commit 07eb075961
2 changed files with 16 additions and 12 deletions

View File

@ -1620,9 +1620,9 @@ class WP_Query {
break; break;
case 'post_name__in': case 'post_name__in':
if ( ! empty( $this->query_vars['post_name__in'] ) ) { if ( ! empty( $this->query_vars['post_name__in'] ) ) {
$post_name__in = array_map( 'sanitize_title_for_query', $this->query_vars['post_name__in'] ); $post_name__in = array_map( 'sanitize_title_for_query', $this->query_vars['post_name__in'] );
$post_name__in_string = "'" . implode( "','", $post_name__in ) . "'"; $post_name__in_string = "'" . implode( "','", $post_name__in ) . "'";
$orderby_clause = "FIELD( {$wpdb->posts}.post_name," . $post_name__in_string . ' )'; $orderby_clause = "FIELD( {$wpdb->posts}.post_name," . $post_name__in_string . ' )';
} }
break; break;
default: default:

View File

@ -182,11 +182,13 @@ class Tests_Post_Query extends WP_UnitTestCase {
$ordered = array( $posts[2], $posts[0], $posts[3] ); $ordered = array( $posts[2], $posts[0], $posts[3] );
$q = new WP_Query( array( $q = new WP_Query(
'post_type' => 'any', array(
'post__in' => $ordered, 'post_type' => 'any',
'orderby' => array( 'post__in' => 'ASC' ), 'post__in' => $ordered,
) ); 'orderby' => array( 'post__in' => 'ASC' ),
)
);
$this->assertSame( $ordered, wp_list_pluck( $q->posts, 'ID' ) ); $this->assertSame( $ordered, wp_list_pluck( $q->posts, 'ID' ) );
} }
@ -198,11 +200,13 @@ class Tests_Post_Query extends WP_UnitTestCase {
$ordered = array( $posts[2], $posts[0], $posts[3] ); $ordered = array( $posts[2], $posts[0], $posts[3] );
$q = new WP_Query( array( $q = new WP_Query(
'post_type' => 'any', array(
'post__in' => $ordered, 'post_type' => 'any',
'orderby' => 'post__in', 'post__in' => $ordered,
) ); 'orderby' => 'post__in',
)
);
$this->assertSame( $ordered, wp_list_pluck( $q->posts, 'ID' ) ); $this->assertSame( $ordered, wp_list_pluck( $q->posts, 'ID' ) );
} }