Users: Update some tests for admin email change confirmation emails after [41164].
See #40015, #39117 git-svn-id: https://develop.svn.wordpress.org/trunk@41170 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8fe419340a
commit
b59d96d978
|
@ -453,22 +453,21 @@ class Tests_Multisite_User extends WP_UnitTestCase {
|
|||
// Assert that HTML entites have been decode in body and subject
|
||||
$this->assertContains( '\'Test\' site\'s "name" has <html entities> &', $email->body, 'Email body does not contain the decoded HTML entities' );
|
||||
$this->assertNotContains( ''Test' site's "name" has <html entities> &', 'Email body does contains HTML entities' );
|
||||
$this->assertContains( '\'Test\' blog\'s "name" has <html entities> &', $email->subject, 'Email body does not contain the decoded HTML entities' );
|
||||
$this->assertContains( '\'Test\' blog\'s "name" has <html entities> &', $email->subject, 'Email subject does not contain the decoded HTML entities' );
|
||||
$this->assertNotContains( ''Test' blog's "name" has <html entities> &', $email->subject, $email->subject, 'Email subject does contains HTML entities' );
|
||||
}
|
||||
|
||||
/**
|
||||
* A notification e-mail should not be sent if the new admin e-mail:
|
||||
* - Matches thee existing admin email, or
|
||||
* - is not a valid e-mail, or
|
||||
* A confirmation email should not be sent if the new admin email:
|
||||
* - Matches the existing admin email, or
|
||||
* - is not a valid email
|
||||
*
|
||||
* @dataProvider data_user_admin_email_notification_emails
|
||||
* @dataProvider data_user_admin_email_confirmation_emails
|
||||
*/
|
||||
function test_ms_new_admin_email_notification_not_sent_when_email_invalid( $email, $message ) {
|
||||
function test_ms_new_admin_email_confirmation_not_sent_when_email_invalid( $email, $message ) {
|
||||
reset_phpmailer_instance();
|
||||
|
||||
update_option( 'admin_email', 'existing-email@test.dev' );
|
||||
update_option_new_admin_email( 'existing-email@test.dev', $email );
|
||||
update_option_new_admin_email( get_option( 'admin_email' ), $email );
|
||||
|
||||
$mailer = tests_retrieve_phpmailer_instance();
|
||||
|
||||
|
@ -476,24 +475,24 @@ class Tests_Multisite_User extends WP_UnitTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Data provider for test_ms_new_admin_email_notification_not_sent_when_email_invalid().
|
||||
* Data provider for test_ms_new_admin_email_confirmation_not_sent_when_email_invalid().
|
||||
*
|
||||
* @return array {
|
||||
* @type array {
|
||||
* @type string $email The new e-mail for admin_email
|
||||
* @type string $email The new email for admin_email
|
||||
* @type string $message An error message to display if the test fails
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
function data_user_admin_email_notification_emails() {
|
||||
function data_user_admin_email_confirmation_emails() {
|
||||
return array(
|
||||
array(
|
||||
'existing-email@test.dev',
|
||||
'A notification e-mail should not be sent if the current admin e-mail matches the new e-mail',
|
||||
get_option( 'admin_email' ),
|
||||
'A confirmation email should not be sent if the current admin email matches the new email',
|
||||
),
|
||||
array(
|
||||
'not an email',
|
||||
'A notification e-mail should not be sent if it is not a valid e-mail',
|
||||
'A confirmation email should not be sent if it is not a valid email',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -533,7 +532,7 @@ class Tests_Multisite_User extends WP_UnitTestCase {
|
|||
// Assert that HTML entites have been decode in body and subject
|
||||
$this->assertContains( '\'Test\' site\'s "name" has <html entities> &', $email->body, 'Email body does not contain the decoded HTML entities' );
|
||||
$this->assertNotContains( ''Test' site's "name" has <html entities> &', $email->body, 'Email body does contains HTML entities' );
|
||||
$this->assertContains( '\'Test\' blog\'s "name" has <html entities> &', $email->subject, 'Email body does not contain the decoded HTML entities' );
|
||||
$this->assertContains( '\'Test\' blog\'s "name" has <html entities> &', $email->subject, 'Email subject does not contain the decoded HTML entities' );
|
||||
$this->assertNotContains( ''Test' blog's "name" has <html entities> &', $email->subject, 'Email subject does contains HTML entities' );
|
||||
|
||||
wp_set_current_user( $old_current );
|
||||
|
|
Loading…
Reference in New Issue