Make WordPress Core


Ignore:
Timestamp:
09/14/2019 09:34:51 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Mail: Add a unit test to make sure wp_mail() does not duplicate the MIME-Version header added automatically by PHPMailer.

See #43542.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/mail.php

    r42343 r46118  
    274274    }
    275275
     276    /**
     277     * @ticket 43542
     278     */
     279    public function test_wp_mail_does_not_duplicate_mime_version_header() {
     280        $to       = 'user@example.com';
     281        $subject  = 'Test email with a MIME-Version header';
     282        $message  = 'The MIME-Version header should not be duplicated.';
     283        $headers  = 'MIME-Version: 1.0';
     284        $expected = 'MIME-Version: 1.0';
     285
     286        wp_mail( $to, $subject, $message, $headers );
     287
     288        $mailer = tests_retrieve_phpmailer_instance();
     289        $this->assertEquals( 1, substr_count( $mailer->get_sent()->header, $expected ) );
     290    }
     291
    276292    function wp_mail_quoted_printable( $mailer ) {
    277293        $mailer->Encoding = 'quoted-printable';
Note: See TracChangeset for help on using the changeset viewer.