X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FMail%2FMailTest.php;fp=web%2Fcore%2Fmodules%2Fsystem%2Ftests%2Fsrc%2FFunctional%2FMail%2FMailTest.php;h=e8accddb6f4e2f2bd6fbec57e6f082e1a3c4e7f0;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=74549a3211e36130d3c7d1edb3be4d5a4d49eb01;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/modules/system/tests/src/Functional/Mail/MailTest.php b/web/core/modules/system/tests/src/Functional/Mail/MailTest.php index 74549a321..e8accddb6 100644 --- a/web/core/modules/system/tests/src/Functional/Mail/MailTest.php +++ b/web/core/modules/system/tests/src/Functional/Mail/MailTest.php @@ -2,6 +2,7 @@ namespace Drupal\Tests\system\Functional\Mail; +use Drupal\Component\Utility\Unicode; use Drupal\Core\Mail\Plugin\Mail\TestMailCollector; use Drupal\Tests\BrowserTestBase; use Drupal\system_mail_failure_test\Plugin\Mail\TestPhpMailFailure; @@ -90,11 +91,15 @@ class MailTest extends BrowserTestBase { $this->assertEqual($reply_email, $sent_message['headers']['Reply-to'], 'Message reply-to headers are set.'); $this->assertFalse(isset($sent_message['headers']['Errors-To']), 'Errors-to header must not be set, it is deprecated.'); + // Test that long site names containing characters that need MIME encoding + // works as expected. + $this->config('system.site')->set('name', 'Drépal this is a very long test sentence to test what happens with very long site names')->save(); // Send an email and check that the From-header contains the site name. \Drupal::service('plugin.manager.mail')->mail('simpletest', 'from_test', 'from_test@example.com', $language); $captured_emails = \Drupal::state()->get('system.test_mail_collector'); $sent_message = end($captured_emails); - $this->assertEqual($from_email, $sent_message['headers']['From'], 'Message is sent from the site email account.'); + $this->assertEquals('=?UTF-8?B?RHLDqXBhbCB0aGlzIGlzIGEgdmVyeSBsb25nIHRlc3Qgc2VudGVuY2UgdG8gdGU=?= ', $sent_message['headers']['From'], 'From header is correctly encoded.'); + $this->assertEquals('Drépal this is a very long test sentence to te ', Unicode::mimeHeaderDecode($sent_message['headers']['From']), 'From header is correctly encoded.'); $this->assertFalse(isset($sent_message['headers']['Reply-to']), 'Message reply-to is not set if not specified.'); $this->assertFalse(isset($sent_message['headers']['Errors-To']), 'Errors-to header must not be set, it is deprecated.'); }