| 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 | wpmu_delete_blog( $site_id ); |
| 410 | |
| 411 | $this->assertWPError( $result ); |
| 412 | } |
| 413 | |
| 414 | /** |
| 415 | * @ticket 41101 |
| 416 | */ |
| 417 | public function test_should_succeed_pre_add_user_to_blog_filter() { |
| 418 | $site_id = self::factory()->blog->create(); |
| 419 | $user_id = self::factory()->user->create(); |
| 420 | |
| 421 | add_filter( 'pre_add_user_to_blog', '__return_true', 10, 4 ); |
| 422 | $result = add_user_to_blog( $site_id, $user_id, 'subscriber' ); |
| 423 | wpmu_delete_blog( $site_id ); |
| 424 | |
| 425 | $this->assertTrue( $result ); |
| 426 | } |
| 427 | |
| 428 | /** |