Add tests for the conversion of 'meta_*' query vars to $meta_query objects in all query classes.

See #31265.

git-svn-id: https://develop.svn.wordpress.org/trunk@31666 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-03-07 16:34:50 +00:00
parent abbbde190c
commit 0fb3e2566f
3 changed files with 43 additions and 0 deletions
+14
View File
@@ -1208,6 +1208,20 @@ class Tests_Query_MetaQuery extends WP_UnitTestCase {
$this->assertEqualSets( array( $post_4, $post_3, $post_2, $post_1 ), $query->posts );
}
public function test_meta_vars_should_be_converted_to_meta_query() {
$q = new WP_Query( array(
'meta_key' => 'foo',
'meta_value' => '5',
'meta_compare' => '>',
'meta_type' => 'SIGNED',
) );
$this->assertSame( 'foo', $q->meta_query->queries[0]['key'] );
$this->assertSame( '5', $q->meta_query->queries[0]['value'] );
$this->assertSame( '>', $q->meta_query->queries[0]['compare'] );
$this->assertSame( 'SIGNED', $q->meta_query->queries[0]['type'] );
}
/**
* @ticket 29604
*/