| 550 | /** |
| 551 | * @ticket BP8081 |
| 552 | */ |
| 553 | public function test_bp_core_activate_signup_admin_notification() { |
| 554 | reset_phpmailer_instance(); |
| 555 | |
| 556 | $key = 'notifyme'; |
| 557 | $signup = self::factory()->signup->create( array( |
| 558 | 'user_login' => 'notifyme', |
| 559 | 'user_email' => 'notifyme@example.org', |
| 560 | 'activation_key' => $key, |
| 561 | 'meta' => array( |
| 562 | 'field_1' => 'Notify Me', |
| 563 | 'password' => 'notifyme', |
| 564 | ), |
| 565 | ) |
| 566 | ); |
| 567 | |
| 568 | $expected = array( |
| 569 | 'non-ms' => array( |
| 570 | 'subject' => sprintf( __( '[%s] New User Registration' ), wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) ), |
| 571 | 'to' => get_option( 'admin_email' ), |
| 572 | ), |
| 573 | 'ms' => array( |
| 574 | 'to' => 'notifyme@example.org', |
| 575 | ), |
| 576 | ); |
| 577 | |
| 578 | bp_core_activate_signup( $key ); |
| 579 | $mailer = tests_retrieve_phpmailer_instance(); |
| 580 | |
| 581 | if ( ! is_multisite() ) { |
| 582 | $this->assertTrue( 1 === count( $mailer->mock_sent ) ); |
| 583 | $this->assertSame( $expected['non-ms']['to'], $mailer->get_recipient( 'to' )->address ); |
| 584 | $this->assertSame( $expected['non-ms']['subject'], $mailer->get_sent()->subject ); |
| 585 | } else { |
| 586 | $this->assertContains( '[User Set]', $mailer->get_sent()->body ); |
| 587 | $this->assertSame( $expected['ms']['to'], $mailer->get_recipient( 'to' )->address ); |
| 588 | } |
| 589 | |
| 590 | reset_phpmailer_instance(); |
| 591 | } |
| 592 | |