| | 1175 | |
| | 1176 | /** |
| | 1177 | * @ticket 20601 |
| | 1178 | */ |
| | 1179 | function test_user_member_of_blog() { |
| | 1180 | $this->factory->blog->create(); |
| | 1181 | $user_id = $this->factory->user->create(); |
| | 1182 | $this->factory->blog->create( array( 'user_id' => $user_id ) ); |
| | 1183 | |
| | 1184 | $blogs = get_blogs_of_user( $user_id ); |
| | 1185 | $this->assertCount( 2, $blogs ); |
| | 1186 | $first = reset( $blogs )->userblog_id; |
| | 1187 | remove_user_from_blog( $user_id, $first ); |
| | 1188 | |
| | 1189 | $blogs = get_blogs_of_user( $user_id ); |
| | 1190 | $second = reset( $blogs )->userblog_id; |
| | 1191 | $this->assertCount( 1, $blogs ); |
| | 1192 | |
| | 1193 | switch_to_blog( $first ); |
| | 1194 | |
| | 1195 | $this->go_to( get_author_posts_url( $user_id ) ); |
| | 1196 | $this->assertQueryTrue( 'is_404' ); |
| | 1197 | |
| | 1198 | switch_to_blog( $second ); |
| | 1199 | |
| | 1200 | $this->go_to( get_author_posts_url( $user_id ) ); |
| | 1201 | $this->assertQueryTrue( 'is_author', 'is_archive' ); |
| | 1202 | |
| | 1203 | add_user_to_blog( $first, $user_id, 'administrator' ); |
| | 1204 | $blogs = get_blogs_of_user( $user_id ); |
| | 1205 | $this->assertCount( 2, $blogs ); |
| | 1206 | |
| | 1207 | switch_to_blog( $first ); |
| | 1208 | |
| | 1209 | $this->go_to( get_author_posts_url( $user_id ) ); |
| | 1210 | $this->assertQueryTrue( 'is_author', 'is_archive' ); |
| | 1211 | } |