Skip to:
Content

BuddyPress.org

Opened 7 years ago

Closed 7 years ago

#7709 closed enhancement (fixed)

Unit Tests: Speed up multisite specific test

Reported by: r-a-y's profile r-a-y Owned by: netweb's profile netweb
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.2
Component: Build/Test Tools Keywords: has-patch
Cc:

Description

One of our multisite unit tests was slowing things down considerably - test_bp_core_get_directory_pages_multisite_delete_post_with_same_bp_page_id().

I introduced this in #6226. Basically, the test would create new posts in a loop(!) until it reached a certain page ID on a sub-site.

There is a much more efficient way of doing this by using a not-well-documented parameter in wp_insert_post() called 'import_id'. Setting 'import_id' will just use the post ID we want to use.

Going to commit.

Attachments (1)

7709.01.patch (1.1 KB) - added by r-a-y 7 years ago.

Download all attachments as: .zip

Change History (2)

@r-a-y
7 years ago

#1 @r-a-y
7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

In 11880:

Unit Tests: Improve performance of multisite directory page test.

The unit test in question was introduced in #6226.

Basically, the test needed to match a specific WordPress post ID.
Previously, the test did this by creating posts in a loop(!) until it
matched the post ID. However, there is a parameter in wp_insert_post()
that allows you to set the post ID from the get-go - 'import_id'.

This commit switches to using the 'import_id' parameter to create the
WordPress post and should speed up this test considerably.

Fixes #7709.

Note: See TracTickets for help on using tickets.