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/comment/query.php

    r31662 r31666  
    13521352    }
    13531353
     1354    public function test_meta_vars_should_be_converted_to_meta_query() {
     1355        $q = new WP_Comment_Query();
     1356        $q->query( array(
     1357            'meta_key' => 'foo',
     1358            'meta_value' => '5',
     1359            'meta_compare' => '>',
     1360            'meta_type' => 'SIGNED',
     1361        ) );
     1362
     1363        $this->assertSame( 'foo', $q->meta_query->queries[0]['key'] );
     1364        $this->assertSame( '5', $q->meta_query->queries[0]['value'] );
     1365        $this->assertSame( '>', $q->meta_query->queries[0]['compare'] );
     1366        $this->assertSame( 'SIGNED', $q->meta_query->queries[0]['type'] );
     1367    }
     1368
    13541369    public function test_count() {
    13551370        $c1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7 ) );
Note: See TracChangeset for help on using the changeset viewer.