From 5462b6c6e9a4609ea1e7d6b0c25dd85c84c73b87 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Wed, 11 Nov 2015 22:04:59 +0000 Subject: [PATCH] Mail: after [33124], add unit tests. Props mdawaffe. Fixes #28039. git-svn-id: https://develop.svn.wordpress.org/trunk@35617 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/mail.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/phpunit/tests/mail.php b/tests/phpunit/tests/mail.php index 96e510dccf..229ff238e8 100644 --- a/tests/phpunit/tests/mail.php +++ b/tests/phpunit/tests/mail.php @@ -254,4 +254,38 @@ class Tests_Mail extends WP_UnitTestCase { $this->assertTrue( strpos( $GLOBALS['phpmailer']->mock_sent[0]['header'], $expected ) > 0 ); } + + function wp_mail_quoted_printable( $mailer ) { + $mailer->Encoding = 'quoted-printable'; + } + + function wp_mail_set_text_message( $mailer ) { + $mailer->AltBody = 'Wörld'; + } + + /** + * > If an entity is of type "multipart" the Content-Transfer-Encoding is + * > not permitted to have any value other than "7bit", "8bit" or + * > "binary". + * http://tools.ietf.org/html/rfc2045#section-6.4 + * + * > "Content-Transfer-Encoding: 7BIT" is assumed if the + * > Content-Transfer-Encoding header field is not present. + * http://tools.ietf.org/html/rfc2045#section-6.1 + * + * @ticket 28039 + */ + function test_wp_mail_content_transfer_encoding_in_quoted_printable_multipart() { + add_action( 'phpmailer_init', array( $this, 'wp_mail_quoted_printable' ) ); + add_action( 'phpmailer_init', array( $this, 'wp_mail_set_text_message' ) ); + + wp_mail( + 'user@example.com', + 'Hello', + '

Wörld

', + 'Content-Type: text/html' + ); + + $this->assertNotContains( 'quoted-printable', $GLOBALS['phpmailer']->mock_sent[0]['header'] ); + } }