Changeset 27689 for trunk/tests/phpunit/tests/meta/query.php
- Timestamp:
- 03/24/2014 07:56:54 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/meta/query.php
r26055 r27689 153 153 $this->assertEquals( 'CHAR', $query->get_cast_for_type( 'ANYTHING ELSE' ) ); 154 154 } 155 156 function test_not_exists() { 157 global $wpdb; 158 159 $query = new WP_Meta_Query( array( 160 'relation' => 'OR', 161 array( 162 'key' => 'exclude', 163 'compare' => 'NOT EXISTS' 164 ), 165 array( 166 'key' => 'exclude', 167 'compare' => '!=', 168 'value' => '1' 169 ), 170 ) ); 171 172 $sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this ); 173 $this->assertNotContains( "{$wpdb->postmeta}.meta_key = 'exclude'\nOR", $sql['where'] ); 174 $this->assertContains( "{$wpdb->postmeta}.post_id IS NULL", $sql['where'] ); 175 } 176 177 function test_empty_compare() { 178 global $wpdb; 179 180 $query = new WP_Meta_Query( array( 181 'relation' => 'OR', 182 array( 183 'key' => 'exclude', 184 'compare' => '' 185 ), 186 array( 187 'key' => 'exclude', 188 'compare' => '!=', 189 'value' => '1' 190 ), 191 ) ); 192 193 $sql = $query->get_sql( 'post', $wpdb->posts, 'ID', $this ); 194 $this->assertContains( "{$wpdb->postmeta}.meta_key = 'exclude'\nOR", $sql['where'] ); 195 $this->assertNotContains( "{$wpdb->postmeta}.post_id IS NULL", $sql['where'] ); 196 } 155 197 }
Note: See TracChangeset
for help on using the changeset viewer.