WordPress.org

Make WordPress Core

Opened 6 weeks ago

Last modified 5 weeks ago

#47195 new defect (bug)

Switch WP_UnitTest_Factory_For_Blog->create_object() to use wp_insert_site()

Reported by: danielbachhuber Owned by:
Milestone: 5.3 Priority: normal
Severity: normal Version:
Component: Build/Test Tools Keywords: has-patch
Focuses: Cc:

Description

WP_UnitTest_Factory_For_Blog->create_object() currently uses wpmu_create_blog(), which produces a deprecated notice (and then fails the test).

It should be switched over to use the wp_insert_site() that landed in r43548

Attachments (2)

47195.diff (891 bytes) - added by davidbaumwald 6 weeks ago.
Patch
47195.2.diff (1.7 KB) - added by davidbaumwald 5 weeks ago.
Updated patch

Download all attachments as: .zip

Change History (7)

#1 follow-up: @jeremyfelt
6 weeks ago

+1, very much.

One note: wpmu_create_blog() itself should not produce a deprecated notice. We left that off for the near term because of how widely used it is. The wpmu_new_blog hook from that function was moved over to wp_insert_site() and that does have a notice attached to it. There's a chance that this would still cause test issues after moving the factory to wp_insert_site().

@davidbaumwald
6 weeks ago

Patch

#2 @SergeyBiryukov
6 weeks ago

  • Keywords has-patch added; needs-patch removed

#3 in reply to: ↑ 1 @danielbachhuber
6 weeks ago

Replying to jeremyfelt:

One note: wpmu_create_blog() itself should not produce a deprecated notice. We left that off for the near term because of how widely used it is. The wpmu_new_blog hook from that function was moved over to wp_insert_site() and that does have a notice attached to it. There's a chance that this would still cause test issues after moving the factory to wp_insert_site().

Yep. My test still failed after I changed it over to wp_insert_site(), which made me realize I had some code hooked on to wpmu_new_blog too. It was the hook that was causing the deprecation notice.

#4 follow-up: @jeremyfelt
5 weeks ago

Thanks for the patch, @davidbaumwald. I think we may need to do a bit more in the $args that are passed to wp_insert_site(). I haven't looked closely yet, but I get 11 failures when running the multisite tests after 47195.diff is applied.

#5 in reply to: ↑ 4 @davidbaumwald
5 weeks ago

Replying to jeremyfelt:

Thanks for the patch, @davidbaumwald. I think we may need to do a bit more in the $args that are passed to wp_insert_site(). I haven't looked closely yet, but I get 11 failures when running the multisite tests after 47195.diff is applied.

Thanks for the feedback @jeremyfelt. I've added to the factory some code that's similar in effect to what wpmu_create_blog was doing. This has resolved the test failures for me. Let me know if there are any issues remaining with the patch or if you'd like to see a different approach.

@davidbaumwald
5 weeks ago

Updated patch

Note: See TracTickets for help on using tickets.