diff --git src/wp-admin/includes/misc.php src/wp-admin/includes/misc.php
index 090282062f..7b46586478 100644
|
|
All at ###SITENAME### |
1531 | 1531 | $site_title = parse_url( home_url(), PHP_URL_HOST ); |
1532 | 1532 | } |
1533 | 1533 | |
| 1534 | $subject = sprintf( |
| 1535 | /* translators: New admin email address notification email subject. %s: Site title. */ |
| 1536 | __( '[%s] New Admin Email Address' ), |
| 1537 | $site_title |
| 1538 | ); |
| 1539 | $subject = apply_filters( 'new_admin_email_subject', $subject ); |
| 1540 | |
1534 | 1541 | wp_mail( |
1535 | 1542 | $value, |
1536 | | sprintf( |
1537 | | /* translators: New admin email address notification email subject. %s: Site title. */ |
1538 | | __( '[%s] New Admin Email Address' ), |
1539 | | $site_title |
1540 | | ), |
| 1543 | $subject, |
1541 | 1544 | $content |
1542 | 1545 | ); |
1543 | 1546 | |
diff --git tests/phpunit/tests/admin/includesMisc.php tests/phpunit/tests/admin/includesMisc.php
index ce0ef7c6c5..2df7f66145 100644
|
|
class Tests_Admin_IncludesMisc extends WP_UnitTestCase { |
27 | 27 | $this->assertSame( $v, url_shorten( $k ) ); |
28 | 28 | } |
29 | 29 | } |
| 30 | |
| 31 | /** |
| 32 | * @ticket 59520 |
| 33 | */ |
| 34 | public function test_new_admin_email_subject_filter() { |
| 35 | // Default value |
| 36 | $mailer = tests_retrieve_phpmailer_instance(); |
| 37 | update_option_new_admin_email( 'old@example.com', 'new@example.com' ); |
| 38 | $this->assertEquals( '[Test Blog] New Admin Email Address', $mailer->get_sent()->subject ); |
| 39 | |
| 40 | // Filtered value |
| 41 | add_filter( |
| 42 | 'new_admin_email_subject', |
| 43 | function () { |
| 44 | return 'Filtered Admin Email Address'; |
| 45 | }, |
| 46 | 10, |
| 47 | 1 |
| 48 | ); |
| 49 | |
| 50 | $mailer->mock_sent = array(); |
| 51 | |
| 52 | $mailer = tests_retrieve_phpmailer_instance(); |
| 53 | update_option_new_admin_email( 'old@example.com', 'new@example.com' ); |
| 54 | $this->assertEquals( 'Filtered Admin Email Address', $mailer->get_sent()->subject ); |
| 55 | } |
30 | 56 | } |