Changeset 33771 for trunk/tests/phpunit/tests/user/multisite.php
- Timestamp:
- 08/27/2015 08:01:37 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/multisite.php
r33143 r33771 142 142 143 143 $user1_id = $this->factory->user->create( array( 'role' => 'administrator' ) ); 144 $user2_id = $this->factory->user->create( array( 'role' => 'administrator' ) ); 144 145 145 146 $old_current = get_current_user_id(); 147 148 $this->assertSame( 0, $old_current ); 149 150 // test for "get current user" when not logged in 151 $this->assertFalse( is_user_member_of_blog() ); 152 146 153 wp_set_current_user( $user1_id ); 147 154 … … 155 162 foreach ( $blog_ids as $blog_id ) { 156 163 $this->assertInternalType( 'int', $blog_id ); 164 165 // Current user gets added to new blogs 157 166 $this->assertTrue( is_user_member_of_blog( $user1_id, $blog_id ) ); 167 // Other users should not 168 $this->assertFalse( is_user_member_of_blog( $user2_id, $blog_id ) ); 169 170 switch_to_blog( $blog_id ); 171 172 $this->assertTrue( is_user_member_of_blog( $user1_id ) ); 173 $this->assertFalse( is_user_member_of_blog( $user2_id ) ); 174 175 // Remove user 1 from blog 158 176 $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) ); 177 178 // Add user 2 to blog 179 $this->assertTrue( add_user_to_blog( $blog_id, $user2_id, 'subscriber' ) ); 180 181 $this->assertFalse( is_user_member_of_blog( $user1_id ) ); 182 $this->assertTrue( is_user_member_of_blog( $user2_id ) ); 183 184 restore_current_blog(); 185 159 186 $this->assertFalse( is_user_member_of_blog( $user1_id, $blog_id ) ); 187 $this->assertTrue( is_user_member_of_blog( $user2_id, $blog_id ) ); 160 188 } 161 189 162 190 wpmu_delete_user( $user1_id ); 163 191 $user = new WP_User( $user1_id ); 164 $this->assertFalse( $user->exists() , 'WP_User->exists');165 $this->assertFalse( is_user_member_of_blog( $user1_id ) , 'is_user_member_of_blog');192 $this->assertFalse( $user->exists() ); 193 $this->assertFalse( is_user_member_of_blog( $user1_id ) ); 166 194 167 195 wp_set_current_user( $old_current );
Note: See TracChangeset
for help on using the changeset viewer.