Make WordPress Core


Ignore:
Timestamp:
10/13/2015 03:25:42 AM (9 years ago)
Author:
boonebgorges
Message:

Correct expected counts in WP_User_Query 'number' test.

The create_many() number should be padded by just one, to account for the
user created by the test suite. Introduced in [35114].

We also don't have to create so many fixtures to run this test.

See #28631.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/query.php

    r35114 r35123  
    439439     */
    440440    function test_number() {
    441         $user_ids = $this->factory->user->create_many( 10 );
     441        // +1 for the default user created by the test suite.
     442        $user_ids = $this->factory->user->create_many( 3 );
    442443
    443444        $users = new WP_User_Query( array( 'blog_id' => get_current_blog_id() ) );
    444445        $users = $users->get_results();
    445 
    446         $this->assertEquals( 12, count( $users ) );
     446        $this->assertEquals( 4, count( $users ) );
    447447
    448448        $users = new WP_User_Query( array( 'blog_id' => get_current_blog_id(), 'number' => 10 ) );
    449449        $users = $users->get_results();
    450         $this->assertEquals( 10, count( $users ) );
     450        $this->assertEquals( 4, count( $users ) );
     451
     452        $users = new WP_User_Query( array( 'blog_id' => get_current_blog_id(), 'number' => 2 ) );
     453        $users = $users->get_results();
     454        $this->assertEquals( 2, count( $users ) );
    451455
    452456        $users = new WP_User_Query( array( 'blog_id' => get_current_blog_id(), 'number' => -1 ) );
    453457        $users = $users->get_results();
    454         $this->assertEquals( 12, count( $users ) );
     458        $this->assertEquals( 4, count( $users ) );
    455459    }
    456460
Note: See TracChangeset for help on using the changeset viewer.