Create fewer fixtures in some XML-RPC tests.

See #30017, #33968.

git-svn-id: https://develop.svn.wordpress.org/trunk@35137 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges 2015-10-13 15:31:26 +00:00
parent e3f8b888ad
commit c067ef07ec
2 changed files with 8 additions and 9 deletions

View File

@ -52,7 +52,7 @@ class Tests_XMLRPC_wp_getPosts extends WP_XMLRPC_UnitTestCase {
));
$post_ids = array();
$num_posts = 17;
$num_posts = 4;
foreach ( range( 1, $num_posts ) as $i ) {
$post_ids[] = $this->factory->post->create( array(
'post_type' => $cpt_name,
@ -67,7 +67,7 @@ class Tests_XMLRPC_wp_getPosts extends WP_XMLRPC_UnitTestCase {
// page through results
$posts_found = array();
$filter['number'] = 5;
$filter['number'] = 2;
$filter['offset'] = 0;
do {
$presults = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) );
@ -78,10 +78,9 @@ class Tests_XMLRPC_wp_getPosts extends WP_XMLRPC_UnitTestCase {
$this->assertEquals( 0, count( array_diff( $post_ids, $posts_found ) ) );
// add comments to some of the posts
$random_posts = array_rand( $post_ids, $num_posts / 2 );
foreach ( $random_posts as $i ) {
$post = $post_ids[$i];
$this->factory->comment->create_post_comments( $post, rand( 1, 20 ) );
foreach ( $post_ids as $key => $post_id ) {
// Larger post IDs will get more comments.
$this->factory->comment->create_post_comments( $post_id, $key );
}
// get results ordered by comment count
@ -96,7 +95,7 @@ class Tests_XMLRPC_wp_getPosts extends WP_XMLRPC_UnitTestCase {
}
// set one of the posts to draft and get drafts
$post = get_post( $post_ids[$random_posts[0]] );
$post = get_post( $post_ids[0] );
$post->post_status = 'draft';
wp_update_post( $post );
$filter3 = array( 'post_type' => $cpt_name, 'post_status' => 'draft' );

View File

@ -79,12 +79,12 @@ class Tests_XMLRPC_wp_getUsers extends WP_XMLRPC_UnitTestCase {
if ( is_multisite() )
grant_super_admin( $administrator_id );
$this->factory->user->create_many( 13 );
$this->factory->user->create_many( 5 );
$user_ids = get_users( array( 'fields' => 'ID' ) );
$users_found = array();
$page_size = floor( count( $user_ids ) / 3 );
$page_size = 2;
$filter = array( 'number' => $page_size, 'offset' => 0 );
do {