[wp-trac] [WordPress Trac] #38433: Complete test coverage for current_user_can_for_blog()

WordPress Trac noreply at wordpress.org
Sun Apr 21 08:19:56 UTC 2019


#38433: Complete test coverage for current_user_can_for_blog()
-------------------------------------------------+-------------------------
 Reporter:  johnbillion                          |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Future
                                                 |  Release
Component:  Role/Capability                      |     Version:  4.3
 Severity:  normal                               |  Resolution:
 Keywords:  needs-unit-tests needs-patch good-   |     Focuses:
  first-bug                                      |
-------------------------------------------------+-------------------------

Comment (by santilinwp):

 Replying to [comment:2 santilinwp]:
 > I'v duplicated the calls in one function:
 `test_subscriber_cant_edit_posts` with the desired result, but then I have
 added a new function to test that an editor CAN edit their posts but no
 others in another site, but it looks like `current_user_can_for_blog`
 takes the current site when the other site doesn't exist.
 >
 > I'll attach the diff and the output.

 Digging a little bit more in the code I've learnt that
 `current_user_can_for_blog` just disregards the `$blog_id` parameter if
 not `is_multisite`, so the test is allright.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/38433#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list