Changeset 31663 for trunk/tests/phpunit/tests/user/query.php
- Timestamp:
- 03/07/2015 04:05:11 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/query.php
r31662 r31663 229 229 // assertEquals() respects order but ignores type (get_results() returns numeric strings). 230 230 $this->assertEquals( array( $users[1], $users[0], $users[3] ), $q->get_results() ); 231 } 232 233 /** 234 * @ticket 31265 235 */ 236 public function test_orderby_space_separated() { 237 global $wpdb; 238 239 $q = new WP_User_Query( array( 240 'orderby' => 'login nicename', 241 'order' => 'ASC', 242 ) ); 243 244 $this->assertContains( "ORDER BY user_login ASC, user_nicename ASC", $q->query_orderby ); 245 } 246 247 /** 248 * @ticket 31265 249 */ 250 public function test_orderby_flat_array() { 251 global $wpdb; 252 253 $q = new WP_User_Query( array( 254 'orderby' => array( 'login', 'nicename' ), 255 ) ); 256 257 $this->assertContains( "ORDER BY user_login ASC, user_nicename ASC", $q->query_orderby ); 258 } 259 260 /** 261 * @ticket 31265 262 */ 263 public function test_orderby_array_contains_invalid_item() { 264 global $wpdb; 265 266 $q = new WP_User_Query( array( 267 'orderby' => array( 'login', 'foo', 'nicename' ), 268 ) ); 269 270 $this->assertContains( "ORDER BY user_login ASC, user_nicename ASC", $q->query_orderby ); 271 } 272 273 /** 274 * @ticket 31265 275 */ 276 public function test_orderby_array_contains_all_invalid_items() { 277 global $wpdb; 278 279 $q = new WP_User_Query( array( 280 'orderby' => array( 'foo', 'bar', 'baz' ), 281 ) ); 282 283 $this->assertContains( "ORDER BY user_login", $q->query_orderby ); 284 } 285 286 /** 287 * @ticket 31265 288 */ 289 public function test_orderby_array() { 290 global $wpdb; 291 292 $q = new WP_User_Query( array( 293 'orderby' => array( 294 'login' => 'DESC', 295 'nicename' => 'ASC', 296 'email' => 'DESC', 297 ), 298 ) ); 299 300 $this->assertContains( "ORDER BY user_login DESC, user_nicename ASC, user_email DESC", $q->query_orderby ); 301 } 302 303 /** 304 * @ticket 31265 305 */ 306 public function test_orderby_array_should_discard_invalid_columns() { 307 global $wpdb; 308 309 $q = new WP_User_Query( array( 310 'orderby' => array( 311 'login' => 'DESC', 312 'foo' => 'ASC', 313 'email' => 'ASC', 314 ), 315 ) ); 316 317 $this->assertContains( "ORDER BY user_login DESC, user_email ASC", $q->query_orderby ); 231 318 } 232 319
Note: See TracChangeset
for help on using the changeset viewer.