-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5835 from Automattic/develop
Staging release: v20240903.1
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -150,6 +150,40 @@ public function test_smtp_servers_not_overwritten(): void { | |
self::assertEquals( $expected, $mailer->Host ); | ||
} | ||
|
||
public function test_smtp_servers_not_overwritten_when_not_present_in_host_overwrite_allow_list(): void { | ||
Constant_Mocker::define( 'VIP_SMTP_HOST_OVERWRITE_ALLOW_LIST', 'server1,not-preset-server,server2' ); | ||
|
||
$GLOBALS['all_smtp_servers'] = [ 'server1', 'server2' ]; | ||
|
||
$expected = 'preset-server'; | ||
|
||
add_action( 'phpmailer_init', function ( PHPMailer &$phpmailer ) use ( $expected ) { | ||
$phpmailer->isSMTP(); | ||
$phpmailer->Host = $expected; | ||
} ); | ||
|
||
wp_mail( '[email protected]', 'Test', 'Test' ); | ||
$mailer = tests_retrieve_phpmailer_instance(); | ||
|
||
self::assertEquals( $expected, $mailer->Host ); | ||
} | ||
|
||
public function test_smtp_servers_are_overwritten_when_present_in_host_overwrite_allow_list(): void { | ||
Constant_Mocker::define( 'VIP_SMTP_HOST_OVERWRITE_ALLOW_LIST', 'server1,overwritable-host,server2' ); | ||
|
||
$GLOBALS['all_smtp_servers'] = [ 'new-host' ]; | ||
|
||
add_action( 'phpmailer_init', function ( PHPMailer &$phpmailer ) { | ||
$phpmailer->isSMTP(); | ||
$phpmailer->Host = 'overwritable-host'; | ||
} ); | ||
|
||
wp_mail( '[email protected]', 'Test', 'Test' ); | ||
$mailer = tests_retrieve_phpmailer_instance(); | ||
|
||
self::assertEquals( 'new-host', $mailer->Host ); | ||
} | ||
|
||
/** | ||
* @ticket GH-3638 | ||
*/ | ||
|
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