Changeset 35114
- Timestamp:
- 10/13/2015 02:39:05 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-user-query.php
r35101 r35114 420 420 421 421 // limit 422 if ( isset( $qv['number'] ) && $qv['number'] ) {422 if ( isset( $qv['number'] ) && $qv['number'] > 0 ) { 423 423 if ( $qv['offset'] ) { 424 424 $this->query_limit = $wpdb->prepare("LIMIT %d, %d", $qv['offset'], $qv['number']); -
trunk/tests/phpunit/tests/user/query.php
r35101 r35114 436 436 437 437 /** 438 * @ticket 28631 439 */ 440 function test_number() { 441 $user_ids = $this->factory->user->create_many( 10 ); 442 443 $users = new WP_User_Query( array( 'blog_id' => get_current_blog_id() ) ); 444 $users = $users->get_results(); 445 446 $this->assertEquals( 12, count( $users ) ); 447 448 $users = new WP_User_Query( array( 'blog_id' => get_current_blog_id(), 'number' => 10 ) ); 449 $users = $users->get_results(); 450 $this->assertEquals( 10, count( $users ) ); 451 452 $users = new WP_User_Query( array( 'blog_id' => get_current_blog_id(), 'number' => -1 ) ); 453 $users = $users->get_results(); 454 $this->assertEquals( 12, count( $users ) ); 455 } 456 457 /** 438 458 * @ticket 21119 439 459 */ … … 470 490 $query->prepare_query(); 471 491 $this->assertEquals( $_query_vars, $query->query_vars ); 492 493 $query->prepare_query( array( 'number' => -1 ) ); 494 $this->assertNotEquals( 'LIMIT -1', $query->query_limit ); 495 $this->assertEmpty( $query->query_limit ); 472 496 } 473 497
Note: See TracChangeset
for help on using the changeset viewer.