mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Users: Further fixes to entitiy decoding in the user email address change confirmation email, and the corresponding tests.
See #16470, #40015 git-svn-id: https://develop.svn.wordpress.org/trunk@41171 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -497,47 +497,6 @@ class Tests_Multisite_User extends WP_UnitTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure email change confirmation emails do not contain encoded HTML entities
|
||||
* @ticket 40015
|
||||
*/
|
||||
function test_ms_send_confirmation_on_profile_email_html_entities_decoded() {
|
||||
|
||||
$old_current = get_current_user_id();
|
||||
$user_id = self::factory()->user->create( array(
|
||||
'role' => 'subscriber',
|
||||
'user_email' => 'old-email@test.dev',
|
||||
) );
|
||||
wp_set_current_user( $user_id );
|
||||
|
||||
reset_phpmailer_instance();
|
||||
|
||||
// Give the site and blog a name containing HTML entities
|
||||
update_site_option( 'site_name', ''Test' site's "name" has <html entities> &' );
|
||||
update_option( 'blogname', ''Test' blog's "name" has <html entities> &' );
|
||||
|
||||
// Set $_POST['email'] with new e-mail and $_POST['id'] with user's ID.
|
||||
$_POST['user_id'] = $user_id;
|
||||
$_POST['email'] = 'new-email@test.dev';
|
||||
send_confirmation_on_profile_email( );
|
||||
|
||||
$mailer = tests_retrieve_phpmailer_instance();
|
||||
|
||||
$recipient = $mailer->get_recipient( 'to' );
|
||||
$email = $mailer->get_sent();
|
||||
|
||||
// Assert reciepient is correct
|
||||
$this->assertSame( 'new-email@test.dev', $recipient->address, 'Admin email change notification recipient not as expected' );
|
||||
|
||||
// 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 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 );
|
||||
}
|
||||
|
||||
/**
|
||||
* A confirmation e-mail should not be sent if user's new e-mail:
|
||||
* - Matches their existing email, or
|
||||
|
||||
Reference in New Issue
Block a user