Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#29896 closed enhancement (fixed)

Organize Multisite Unit Tests

Reported by: jeremyfelt's profile jeremyfelt Owned by: jeremyfelt's profile jeremyfelt
Milestone: 4.1 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch
Focuses: multisite Cc:


In the near future, I'd like to expand what we're testing in our multisite unit tests quite a bit. The single ms.php file we have now is getting long and unwieldy.

The attached patch:

  • Adds a multisite/ directory with test classes for sites, users, and bootstrap.
  • Adds groups ms-sites, ms-users, ms-bootstrap to handle the running of similar tests in an easier way.

I've left a handful of tests in the original ms.php file and am pondering where to put these. This may be good for now until other tests in those areas are written.

Attachments (3)

29896.diff (99.3 KB) - added by jeremyfelt 10 years ago.
29896.2.diff (177.0 KB) - added by jeremyfelt 10 years ago.
29896.3.diff (202.3 KB) - added by jeremyfelt 10 years ago.

Download all attachments as: .zip

Change History (10)

10 years ago

#1 follow-up: @boonebgorges
10 years ago

Big +1.

#2 in reply to: ↑ 1 @rclilly
10 years ago

Replying to boonebgorges:

Big +1.


This ticket was mentioned in IRC in #wordpress-dev by jeremyfelt. View the logs.

10 years ago

#4 @nacin
10 years ago

  • Owner set to jeremyfelt
  • Status changed from new to assigned

The only thing I'd suggest is we try to follow the existing UT naming conventions:

  • ms.php should become multisite.php to correspond with the multisite/ directory.
  • multisite/users.php would be multisite/user.php, sites.php would be site.php.

Thought: should these instead be user/multisite.php?

Huge +1.

10 years ago

10 years ago

#5 @jeremyfelt
10 years ago

Replying to nacin:

Thought: should these instead be user/multisite.php?


I think if we have multisite specific tests for other components (users, options, media, taxonomy), we should use a multisite.php in that directory. (i.e. similar to focuses and components in Trac)

For the "networks and sites" component as well as the multisite boot process, I think we're good with a multisite/ directory.

We go this direction in 29896.3.diff:

  • ms.php becomes multisite.php and retains a couple registration related tests. We can move these out over time once we start testing that process.
  • Tests specific to options move from option/blogOption.php to option/multisite.php. This also brings one multisite specific test from option/siteOption.php. Really, *_site_option() is *_option() in single site, so the naming here can get confusing.
  • Tests specific to users are in user/multisite.php
  • Tests specific to sites on a network are in multisite/site.php
  • Tests specific to networks are in multisite/network.php
  • Tests specific to the bootstrap / load process are in multisite/bootstrap.php

We can now run tests with ms-site, ms-user, ms-option, ms-network, and ms-bootstrap groups, which is nice.

I'm going to sleep on it, but it's feeling good and everything is still passing. :)

#6 @jeremyfelt
10 years ago

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

In 29916:

Split and organize multisite unit tests

  • Move ms.php to multisite.php
  • Create multisite.php under directories option/ and user/ to better match existing structure.
  • Create a multisite/ directory containing bootstrap.php, site.php, and network.php for very multisite specific testing.
  • Add unit test groups ms-site, ms-user, ms-option, ms-network, and ms-bootstrap.

Fixes #29896

#7 @DrewAPicture
10 years ago

Thank you for doing this.

Note: See TracTickets for help on using tickets.