#47195 closed defect (bug) (fixed)
Switch WP_UnitTest_Factory_For_Blog->create_object() to use wp_insert_site()
Reported by: | danielbachhuber | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.4 | 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)
Change History (14)
#3
in reply to:
↑ 1
@
6 years 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. Thewpmu_new_blog
hook from that function was moved over towp_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 towp_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:
↓ 5
@
6 years 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
@
6 years 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 towp_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.
#6
@
5 years ago
- Milestone changed from 5.3 to 5.4
Due to lack of updates, punting this to 5.4 to clear the way for 5.3
#12
@
5 years ago
For future reference, the site_id
and meta
mapping added to WP_UnitTest_Factory_For_Blog
in [47011] can now be removed, and the tests should still pass.
That said, I think it makes sense to keep the mapping for now for back compat just in case there are any plugins using the factory in their own tests.
+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. Thewpmu_new_blog
hook from that function was moved over towp_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 towp_insert_site()
.