Changeset 47013 for trunk/tests/phpunit/tests/user/multisite.php
- Timestamp:
- 12/25/2019 09:39:46 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/multisite.php
r47012 r47013 123 123 $this->assertTrue( is_blog_user( get_current_blog_id() ) ); 124 124 125 $blog_ids = array(); 126 127 $blog_ids = self::factory()->blog->create_many( 1 ); 128 foreach ( $blog_ids as $blog_id ) { 129 $this->assertInternalType( 'int', $blog_id ); 130 $this->assertTrue( is_blog_user( $blog_id ) ); 131 $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) ); 132 $this->assertFalse( is_blog_user( $blog_id ) ); 133 } 125 $blog_id = self::factory()->blog->create( array( 'user_id' => get_current_user_id() ) ); 126 127 $this->assertInternalType( 'int', $blog_id ); 128 $this->assertTrue( is_blog_user( $blog_id ) ); 129 $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) ); 130 $this->assertFalse( is_blog_user( $blog_id ) ); 134 131 135 132 wp_set_current_user( $old_current ); … … 158 155 $this->assertTrue( is_user_member_of_blog( $user1_id, $site_id ) ); 159 156 160 $blog_ids = self::factory()->blog->create_many( 1 ); 161 foreach ( $blog_ids as $blog_id ) { 162 $this->assertInternalType( 'int', $blog_id ); 163 164 // Current user gets added to new blogs 165 $this->assertTrue( is_user_member_of_blog( $user1_id, $blog_id ) ); 166 // Other users should not 167 $this->assertFalse( is_user_member_of_blog( $user2_id, $blog_id ) ); 168 169 switch_to_blog( $blog_id ); 170 171 $this->assertTrue( is_user_member_of_blog( $user1_id ) ); 172 $this->assertFalse( is_user_member_of_blog( $user2_id ) ); 173 174 // Remove user 1 from blog 175 $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) ); 176 177 // Add user 2 to blog 178 $this->assertTrue( add_user_to_blog( $blog_id, $user2_id, 'subscriber' ) ); 179 180 $this->assertFalse( is_user_member_of_blog( $user1_id ) ); 181 $this->assertTrue( is_user_member_of_blog( $user2_id ) ); 182 183 restore_current_blog(); 184 185 $this->assertFalse( is_user_member_of_blog( $user1_id, $blog_id ) ); 186 $this->assertTrue( is_user_member_of_blog( $user2_id, $blog_id ) ); 187 } 157 $blog_id = self::factory()->blog->create( array( 'user_id' => get_current_user_id() ) ); 158 159 $this->assertInternalType( 'int', $blog_id ); 160 161 // Current user gets added to new blogs 162 $this->assertTrue( is_user_member_of_blog( $user1_id, $blog_id ) ); 163 // Other users should not 164 $this->assertFalse( is_user_member_of_blog( $user2_id, $blog_id ) ); 165 166 switch_to_blog( $blog_id ); 167 168 $this->assertTrue( is_user_member_of_blog( $user1_id ) ); 169 $this->assertFalse( is_user_member_of_blog( $user2_id ) ); 170 171 // Remove user 1 from blog 172 $this->assertTrue( remove_user_from_blog( $user1_id, $blog_id ) ); 173 174 // Add user 2 to blog 175 $this->assertTrue( add_user_to_blog( $blog_id, $user2_id, 'subscriber' ) ); 176 177 $this->assertFalse( is_user_member_of_blog( $user1_id ) ); 178 $this->assertTrue( is_user_member_of_blog( $user2_id ) ); 179 180 restore_current_blog(); 181 182 $this->assertFalse( is_user_member_of_blog( $user1_id, $blog_id ) ); 183 $this->assertTrue( is_user_member_of_blog( $user2_id, $blog_id ) ); 188 184 189 185 wpmu_delete_user( $user1_id );
Note: See TracChangeset
for help on using the changeset viewer.