WordPress.org

Make WordPress Core


Ignore:
Timestamp:
03/07/2015 04:34:50 PM (7 years ago)
Author:
boonebgorges
Message:

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

See #31265.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/query.php

    r31663 r31666  
    353353        $query->prepare_query();
    354354        $this->assertEquals( $_query_vars, $query->query_vars );
     355    }
     356
     357    public function test_meta_vars_should_be_converted_to_meta_query() {
     358        $q = new WP_User_Query( array(
     359            'meta_key' => 'foo',
     360            'meta_value' => '5',
     361            'meta_compare' => '>',
     362            'meta_type' => 'SIGNED',
     363        ) );
     364
     365        $this->assertSame( 'foo', $q->meta_query->queries[0]['key'] );
     366        $this->assertSame( '5', $q->meta_query->queries[0]['value'] );
     367        $this->assertSame( '>', $q->meta_query->queries[0]['compare'] );
     368        $this->assertSame( 'SIGNED', $q->meta_query->queries[0]['type'] );
    355369    }
    356370
Note: See TracChangeset for help on using the changeset viewer.