Changeset 1276 in tests for trunk/tests/meta/query.php
- Timestamp:
- 04/29/2013 09:02:38 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/meta/query.php
r1173 r1276 80 80 $this->assertEquals( array( array( 'key' => 'abc', 'compare' => '=>' ) ), $query->queries ); 81 81 } 82 83 /* 84 * @ticket 22096 85 */ 86 function test_empty_value_sql() { 87 global $wpdb; 88 89 $query = new WP_Meta_Query(); 90 91 $the_complex_query['meta_query'] = array( 92 array( 'key' => 'my_first_key', 'value' => 'my_amazing_value' ), 93 array( 'key' => 'my_second_key', 'compare' => 'NOT EXISTS' ), 94 array( 'key' => 'my_third_key', 'value' => array( ), 'compare' => 'IN' ), 95 ); 96 97 $query->parse_query_vars( $the_complex_query ); 98 99 $sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this ); 100 101 // We should have 2 joins - one for my_first_key and one for my_second_key 102 $this->assertEquals( 2, substr_count( $sql['join'], 'INNER JOIN' ) ); 103 104 // The WHERE should check my_third_key against an unaliased table 105 $this->assertEquals( 1, substr_count( $sql['where'], "wp_postmeta.meta_key = 'my_third_key'" ) ); 106 107 } 82 108 }
Note: See TracChangeset
for help on using the changeset viewer.