| 401 | * @ticket 41101 |
| 402 | */ |
| 403 | public function test_should_fail_pre_add_user_to_blog_filter() { |
| 404 | $site_id = self::factory()->blog->create(); |
| 405 | $user_id = self::factory()->user->create(); |
| 406 | |
| 407 | add_filter( 'pre_add_user_to_blog', '__return_false', 10, 4 ); |
| 408 | $result = add_user_to_blog( $site_id, $user_id, 'subscriber' ); |
| 409 | |
| 410 | remove_filter( 'pre_add_user_to_blog', '__return_false', 10 ); |
| 411 | wpmu_delete_blog( $site_id ); |
| 412 | wpmu_delete_user( $user_id ); |
| 413 | |
| 414 | $this->assertWPError( $result ); |
| 415 | } |
| 416 | |
| 417 | /** |
| 418 | * @ticket 41101 |
| 419 | */ |
| 420 | public function test_should_succeed_pre_add_user_to_blog_filter() { |
| 421 | $site_id = self::factory()->blog->create(); |
| 422 | $user_id = self::factory()->user->create(); |
| 423 | |
| 424 | add_filter( 'pre_add_user_to_blog', '__return_true', 10, 4 ); |
| 425 | $result = add_user_to_blog( $site_id, $user_id, 'subscriber' ); |
| 426 | |
| 427 | remove_filter( 'pre_add_user_to_blog', '__return_true', 10 ); |
| 428 | wpmu_delete_blog( $site_id ); |
| 429 | wpmu_delete_user( $user_id ); |
| 430 | |
| 431 | $this->assertTrue( $result ); |
| 432 | } |
| 433 | |
| 434 | /** |