Changeset 45013 for branches/4.0/tests/phpunit/tests/mail.php
- Timestamp:
- 03/26/2019 12:45:57 AM (6 years ago)
- Location:
- branches/4.0
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.0
- Property svn:mergeinfo changed
/trunk merged: 29860,29869,29954,30160,30530
- Property svn:mergeinfo changed
-
branches/4.0/tests/phpunit/tests/mail.php
r32148 r45013 70 70 $this->assertTrue(strpos($GLOBALS['phpmailer']->mock_sent[0]['header'], 'boundary="----=_Part_4892_25692638.1192452070893"') > 0); 71 71 $this->assertTrue(strpos($GLOBALS['phpmailer']->mock_sent[0]['header'], 'charset=') > 0); 72 }73 74 /**75 * @ticket 1544876 */77 function test_wp_mail_plain_and_html() {78 $to = 'user@example.com';79 $subject = 'Test email with plain text and html versions';80 $messages = array( 'text/plain' => 'Here is some plain text.',81 'text/html' =>'<html><head></head><body>Here is the HTML ;-)<body></html>' );82 83 wp_mail( $to, $subject, $messages );84 85 preg_match( '/boundary="(.*)"/', $GLOBALS['phpmailer']->mock_sent[0]['header'], $matches);86 $boundry = $matches[1];87 $body = '--' . $boundry . '88 Content-Type: text/plain; charset = "UTF-8"89 Content-Transfer-Encoding: 8bit90 91 Here is some plain text.92 93 94 --' . $boundry . '95 Content-Type: text/html; charset = "UTF-8"96 Content-Transfer-Encoding: 8bit97 98 <html><head></head><body>Here is the HTML ;-)<body></html>99 100 101 102 --' . $boundry . '--103 ';104 // We need some better assertions here but these test the behaviour for now.105 $this->assertEquals($body, $GLOBALS['phpmailer']->mock_sent[0]['body']);106 72 } 107 73
Note: See TracChangeset
for help on using the changeset viewer.