mirrored from git://develop.git.wordpress.org/
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Administration: Introduce
new_admin_email_subject
filter.
This changeset introduces the `new_admin_email_subject` hook which allow developers to filter the subject of the email sent when a change of site admin email address is attempted. Props MadtownLems, johnbillion, alexanderkoledov, shooper, Marc_J, nikmeyer, xlthlx, devmuhib, nuhel, audrasjb. Fixes #59250. git-svn-id: https://develop.svn.wordpress.org/trunk@57283 602fd350-edb4-49c9-b593-d223f7449a82
- Loading branch information
Showing
2 changed files
with
41 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,30 @@ public function test_shorten_url() { | |
$this->assertSame( $v, url_shorten( $k ) ); | ||
} | ||
} | ||
|
||
/** | ||
* @ticket 59520 | ||
*/ | ||
public function test_new_admin_email_subject_filter() { | ||
// Default value | ||
$mailer = tests_retrieve_phpmailer_instance(); | ||
update_option_new_admin_email( '[email protected]', '[email protected]' ); | ||
$this->assertEquals( '[Test Blog] New Admin Email Address', $mailer->get_sent()->subject ); | ||
|
||
// Filtered value | ||
add_filter( | ||
'new_admin_email_subject', | ||
function () { | ||
return 'Filtered Admin Email Address'; | ||
}, | ||
10, | ||
1 | ||
); | ||
|
||
$mailer->mock_sent = array(); | ||
|
||
$mailer = tests_retrieve_phpmailer_instance(); | ||
update_option_new_admin_email( '[email protected]', '[email protected]' ); | ||
$this->assertEquals( 'Filtered Admin Email Address', $mailer->get_sent()->subject ); | ||
} | ||
} |