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. git-svn-id: https://develop.svn.wordpress.org/trunk@35123 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a6a0045460
commit
0091665f1c
@ -438,20 +438,24 @@ class Tests_User_Query extends WP_UnitTestCase {
|
|||||||
* @ticket 28631
|
* @ticket 28631
|
||||||
*/
|
*/
|
||||||
function test_number() {
|
function test_number() {
|
||||||
$user_ids = $this->factory->user->create_many( 10 );
|
// +1 for the default user created by the test suite.
|
||||||
|
$user_ids = $this->factory->user->create_many( 3 );
|
||||||
|
|
||||||
$users = new WP_User_Query( array( 'blog_id' => get_current_blog_id() ) );
|
$users = new WP_User_Query( array( 'blog_id' => get_current_blog_id() ) );
|
||||||
$users = $users->get_results();
|
$users = $users->get_results();
|
||||||
|
$this->assertEquals( 4, count( $users ) );
|
||||||
$this->assertEquals( 12, count( $users ) );
|
|
||||||
|
|
||||||
$users = new WP_User_Query( array( 'blog_id' => get_current_blog_id(), 'number' => 10 ) );
|
$users = new WP_User_Query( array( 'blog_id' => get_current_blog_id(), 'number' => 10 ) );
|
||||||
$users = $users->get_results();
|
$users = $users->get_results();
|
||||||
$this->assertEquals( 10, count( $users ) );
|
$this->assertEquals( 4, count( $users ) );
|
||||||
|
|
||||||
|
$users = new WP_User_Query( array( 'blog_id' => get_current_blog_id(), 'number' => 2 ) );
|
||||||
|
$users = $users->get_results();
|
||||||
|
$this->assertEquals( 2, count( $users ) );
|
||||||
|
|
||||||
$users = new WP_User_Query( array( 'blog_id' => get_current_blog_id(), 'number' => -1 ) );
|
$users = new WP_User_Query( array( 'blog_id' => get_current_blog_id(), 'number' => -1 ) );
|
||||||
$users = $users->get_results();
|
$users = $users->get_results();
|
||||||
$this->assertEquals( 12, count( $users ) );
|
$this->assertEquals( 4, count( $users ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user