Improve the efficiency of is_user_member_of_blog() by removing its use of get_blogs_of_user(). Adds additional tests.

Fixes #32472
Props BinaryKitten, sammybeats, johnbillion


git-svn-id: https://develop.svn.wordpress.org/trunk@33771 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2015-08-27 20:01:37 +00:00
parent 0d0a8353f5
commit f312173db5
3 changed files with 80 additions and 6 deletions

View File

@@ -366,6 +366,11 @@ class Tests_User extends WP_UnitTestCase {
function test_is_user_member_of_blog() {
$old_current = get_current_user_id();
$this->assertSame( 0, $old_current );
// test for "get current user" when not logged in
$this->assertFalse( is_user_member_of_blog() );
$user_id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
wp_set_current_user( $user_id );