Make WordPress Core

Changeset 35617


Ignore:
Timestamp:
11/11/2015 10:04:59 PM (9 years ago)
Author:
wonderboymusic
Message:

Mail: after [33124], add unit tests.

Props mdawaffe.
Fixes #28039.

File:
1 edited

Legend:

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

    r35350 r35617  
    255255        $this->assertTrue( strpos( $GLOBALS['phpmailer']->mock_sent[0]['header'], $expected ) > 0 );
    256256    }
     257
     258    function wp_mail_quoted_printable( $mailer ) {
     259        $mailer->Encoding = 'quoted-printable';
     260    }
     261
     262    function wp_mail_set_text_message( $mailer ) {
     263        $mailer->AltBody = 'Wörld';
     264    }
     265
     266    /**
     267     * > If an entity is of type "multipart" the Content-Transfer-Encoding is
     268     * > not permitted to have any value other than "7bit", "8bit" or
     269     * > "binary".
     270     * http://tools.ietf.org/html/rfc2045#section-6.4
     271     *
     272     * > "Content-Transfer-Encoding: 7BIT" is assumed if the
     273     * > Content-Transfer-Encoding header field is not present.
     274     * http://tools.ietf.org/html/rfc2045#section-6.1
     275     *
     276     * @ticket 28039
     277     */
     278    function test_wp_mail_content_transfer_encoding_in_quoted_printable_multipart() {
     279        add_action( 'phpmailer_init', array( $this, 'wp_mail_quoted_printable' ) );
     280        add_action( 'phpmailer_init', array( $this, 'wp_mail_set_text_message' ) );
     281
     282        wp_mail(
     283            'user@example.com',
     284            'Hello',
     285            '<p><strong>Wörld</strong></p>',
     286            'Content-Type: text/html'
     287        );
     288
     289        $this->assertNotContains( 'quoted-printable', $GLOBALS['phpmailer']->mock_sent[0]['header'] );
     290    }
    257291}
Note: See TracChangeset for help on using the changeset viewer.